Skip to content

Instantly share code, notes, and snippets.

@ryan-allen
Created May 31, 2010 01:43
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 ryan-allen/419463 to your computer and use it in GitHub Desktop.
Save ryan-allen/419463 to your computer and use it in GitHub Desktop.
class Object
def if
yield if self
end
def else
yield if not self
end
end
true.if do
puts 'this is true, you will hear from me'
end
false.if do
puts 'you will not hear from me'
end
nil.if do
puts 'nor me'
end
nil.else do
puts 'but i will make some noise here'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment