Skip to content

Instantly share code, notes, and snippets.

@codeincontext
Created June 22, 2011 15:18
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 codeincontext/1040315 to your computer and use it in GitHub Desktop.
Save codeincontext/1040315 to your computer and use it in GitHub Desktop.
'method?' behaviour on all ruby objects
class Object
def method_missing(method, *args, &block)
if (m = method.to_s).ends_with? '?'
!!send(m.chop, *args, &block)
else
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment