Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > where is instance_eval() defined?

Reply
Thread Tools

where is instance_eval() defined?

 
 
7stud --
Guest
Posts: n/a
 
      05-18-2011
Where in the hell is instance_eval() defined? In "The Ruby Programming
Language", it says it's defined in Object, but the 1.9.2 docs don't list
it in Object:

http://www.ruby-doc.org/core/classes/Object.html

Nor is it listed in BasicObjec, Kernel, Module, or Class:

http://www.ruby-doc.org/core-1.9/cla...sicObject.html
http://www.ruby-doc.org/core/classes/Kernel.html
http://ruby-doc.org/core/classes/Module.html
http://www.ruby-doc.org/core/classes/Class.html

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

 
Reply With Quote
 
 
 
 
Phillip Gawlowski
Guest
Posts: n/a
 
      05-18-2011
On Wed, May 18, 2011 at 11:10 PM, 7stud -- <(E-Mail Removed)> wrote:
> Where in the hell is instance_eval() defined? =A0In "The Ruby Programming
> Language", it says it's defined in Object, but the 1.9.2 docs don't list
> it in Object:


irb --simple-prompt
>> require "pp"
>> pp Object.methods.sort


--=20
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

 
Reply With Quote
 
 
 
 
Su Zhang
Guest
Posts: n/a
 
      05-19-2011
7stud -- wrote in post #999537:
> Nor is it listed in BasicObjec


p RUBY_VERSION # => "1.9.2"
p BasicObject.public_instance_methods.grep(/eval/) # => [:instance_eval]

and in vm_eval.c:

rb_define_method(rb_cBasicObject, "instance_eval", rb_obj_instance_eval,
-1);

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

 
Reply With Quote
 
7stud --
Guest
Posts: n/a
 
      05-19-2011
Thanks. Does anyone want to fix that in the 1.9.2 docs?

Also, I can never find the methods() method anywhere. Module?
BasicObject?

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

 
Reply With Quote
 
John Mair
Guest
Posts: n/a
 
      05-21-2011
In future do this:

method(:instance_eval).owner #=> BasicObject

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments