Created
December 29, 2010 16:32
-
-
Save Ejhfast/758707 to your computer and use it in GitHub Desktop.
method missing
This file contains 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
def method_missing(symbol, &block) | |
if block_given? | |
self.class.send :define_method, symbol, &block | |
else | |
bdy = proc {|*x| symbol} | |
self.class.send :define_method, symbol, bdy | |
end | |
@dynamic_methods << symbol | |
symbol | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment