Last active
February 11, 2017 05:45
-
-
Save lbvf50mobile/d7f0ca6099bf6da7b09d0a41106e9592 to your computer and use it in GitHub Desktop.
if_else using messages and objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TrueClass | |
def is_true | |
yield | |
self | |
end | |
def is_false | |
self | |
end | |
end | |
class FalseClass | |
def is_true | |
self | |
end | |
def is_false | |
yield | |
self | |
end | |
end | |
puts "hi" | |
(1==1).is_true{ puts "yes"} | |
(1==3).is_false{puts "yes it false"} | |
[true,false].each{|i| (i).is_true{puts "this is true"}.is_false{puts "this is false"}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment