mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-15 07:23:19 -04:00
Use alt example in about_open_classes
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
This commit is contained in:
@@ -30,14 +30,14 @@ class AboutOpenClasses < Neo::Koan
|
|||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
class ::Integer
|
class ::Integer
|
||||||
def even?
|
def answer_to_life_universe_and_everything?
|
||||||
(self % 2) == 0
|
self == 42
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_even_existing_built_in_classes_can_be_reopened
|
def test_even_existing_built_in_classes_can_be_reopened
|
||||||
assert_equal __(false), 1.even?
|
assert_equal __(false), 1.answer_to_life_universe_and_everything?
|
||||||
assert_equal __(true), 2.even?
|
assert_equal __(true), 42.answer_to_life_universe_and_everything?
|
||||||
end
|
end
|
||||||
|
|
||||||
# NOTE: To understand why we need the :: before Integer, you need to
|
# NOTE: To understand why we need the :: before Integer, you need to
|
||||||
|
|||||||
Reference in New Issue
Block a user