Created
June 30, 2011 19:08
-
-
Save pcarrier/1056949 to your computer and use it in GitHub Desktop.
Run this in Ruby and enjoy.
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 easier_life | |
nilmm = NilClass.instance_method(:method_missing) | |
NilClass.send :define_method, :method_missing, lambda {|*whatev|} | |
yield | |
NilClass.send :define_method, :method_missing, nilmm | |
end | |
def broken_code | |
[:only_item][10].oops.thats.very.wrong | |
[:only_item][10].oops.thats.very.wrong :with, :arguments | |
puts "whatever, I'm always happy" | |
end | |
easier_life do | |
broken_code | |
end | |
puts 'What happens without my hack? The answer after <enter>...' | |
$stdin.gets | |
broken_code |
Daenyth
commented
Jul 1, 2011
Oh you're right, I reproduced that with ruby 1.9.
Doing a new revision that works with 1.8 and 1.9.
... and here you go.
Thanks for the bug report!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment