Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Why does `public_class_method` in an anonymous module make the method public on `Object`?
➜ irb
1.9.3p327 :001 > Object.define_method
NoMethodError: private method `define_method' called for Object:Class
from (irb):1
from /Users/myron/.rvm/rubies/ruby-1.9.3-p327/bin/irb:16:in `<main>'
1.9.3p327 :002 > m = do
1.9.3p327 :003 > public_class_method :define_method
1.9.3p327 :004?> end
=> #<Module:0x007fd4c493d8e8>
1.9.3p327 :005 > Object.define_method
ArgumentError: wrong number of arguments (0 for 1)
from (irb):5:in `define_method'
from (irb):5
from /Users/myron/.rvm/rubies/ruby-1.9.3-p327/bin/irb:16:in `<main>'
1.9.3p327 :006 > exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.