Created
June 22, 2011 15:18
-
-
Save codeincontext/1040315 to your computer and use it in GitHub Desktop.
'method?' behaviour on all ruby 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 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