Created
December 13, 2011 02:33
-
-
Save seebq/1470193 to your computer and use it in GitHub Desktop.
Don't alter the method parameter
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 Car | |
# http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing | |
def method_missing(method, *args, &block) | |
# don't do: | |
method.gsub!("gasoline", "electricity") | |
# also don't do: | |
method = method.to_s | |
# ... | |
super | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment