Created
June 2, 2011 16:04
-
-
Save nouse/1004707 to your computer and use it in GitHub Desktop.
put method before object
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
module Kernel | |
def method_missing(name, *args, &block) | |
if args[0].respond_to?(name) | |
args[0].send(name, *args[1..-1], &block) | |
else | |
super | |
end | |
end | |
end | |
p upcase "little prince" | |
p reduce [1,2,3,4], 0, &:+ | |
p a 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment