Skip to content

Instantly share code, notes, and snippets.

@shtirlic
Created November 16, 2012 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shtirlic/4090512 to your computer and use it in GitHub Desktop.
Save shtirlic/4090512 to your computer and use it in GitHub Desktop.
True/False block for bool (inspired by @rkh)
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