Created
August 15, 2012 16:00
-
-
Save erubboli/3361197 to your computer and use it in GitHub Desktop.
undef_method
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
jruby-1.7.0.preview1 :001 > class A | |
jruby-1.7.0.preview1 :002?> end | |
=> nil | |
jruby-1.7.0.preview1 :003 > class Object | |
jruby-1.7.0.preview1 :004?> def to_json | |
jruby-1.7.0.preview1 :005?> raise "don't call me" | |
jruby-1.7.0.preview1 :006?> end | |
jruby-1.7.0.preview1 :007?> end | |
=> nil | |
jruby-1.7.0.preview1 :008 > a=A.new | |
=> #<A:0x1d9dbdc4> | |
jruby-1.7.0.preview1 :009 > a.to_json | |
RuntimeError: don't call me | |
[...] | |
jruby-1.7.0.preview1 :011 > class << a | |
jruby-1.7.0.preview1 :012?> undef_method :to_json | |
jruby-1.7.0.preview1 :013?> end | |
=> #<Class:#<A:0x1d9dbdc4>> | |
jruby-1.7.0.preview1 :014 > a.to_json | |
NoMethodError: undefined method `to_json' for #<A:0x1d9dbdc4> | |
[...] | |
=> false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment