Created
November 16, 2012 20:16
-
-
Save shtirlic/4090512 to your computer and use it in GitHub Desktop.
True/False block for bool (inspired by @rkh)
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
def true.if_true; yield end; | |
def false.if_true; end; | |
def true.if_false; end; | |
def false.if_false; yield end; | |
a = true | |
a.if_true do | |
puts "Yes I am True" | |
end | |
a.if_false do | |
puts "Yes I am False" | |
end | |
a = false | |
a.if_true do | |
puts "Yes I am True" | |
end | |
a.if_false do | |
puts "Yes I am False" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment