Skip to content

Instantly share code, notes, and snippets.

@pcarrier
Created June 30, 2011 19:08
Show Gist options
  • Save pcarrier/1056949 to your computer and use it in GitHub Desktop.
Save pcarrier/1056949 to your computer and use it in GitHub Desktop.
Run this in Ruby and enjoy.
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
@pcarrier
Copy link
Author

pcarrier commented Jul 2, 2011

... 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