From 561965bb6a112a15955a96e1de62c4671d13ed2f Mon Sep 17 00:00:00 2001 From: Tony Schneider Date: Sun, 13 Feb 2022 14:54:14 +0000 Subject: [PATCH] Use alt example in about_open_classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Integer#even? ended up in a more modern version of ruby (yay progress!). This updates the koan to use a different, more outlandish example, that I don’t think will end up in Ruby — and that I know Jim would appreciate <3 --- src/about_open_classes.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/about_open_classes.rb b/src/about_open_classes.rb index 0372f50..1f011bf 100644 --- a/src/about_open_classes.rb +++ b/src/about_open_classes.rb @@ -30,14 +30,14 @@ class AboutOpenClasses < Neo::Koan # ------------------------------------------------------------------ class ::Integer - def even? - (self % 2) == 0 + def answer_to_life_universe_and_everything? + self == 42 end end def test_even_existing_built_in_classes_can_be_reopened - assert_equal __(false), 1.even? - assert_equal __(true), 2.even? + assert_equal __(false), 1.answer_to_life_universe_and_everything? + assert_equal __(true), 42.answer_to_life_universe_and_everything? end # NOTE: To understand why we need the :: before Integer, you need to