Saturday, October 13, 2012

[Rails] Re: Why does Kernel define class_eval?

obj = Object.new
obj.class_eval {}

--output:--
1.rb:2:in `<main>': undefined method `class_eval' for
#<Object:0x000001010913f0> (NoMethodError)


puts Kernel.instance_methods(false).include? :class_eval

--output:--
false


$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0]

$ rvm use 1.8.7

$ ruby --version
ruby 1.8.7 (2012-06-29 patchlevel 370) [i686-darwin10.8.0]

obj = Object.new
obj.class_eval {}

--output:--
1.rb:2:in `<main>': undefined method `class_eval' for
#<Object:0x000001010913f0> (NoMethodError)


puts Kernel.instance_methods(false).include? :class_eval

--output:--
false

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate