Hello!
Does anyone know the reason for the following?
p rio(’.’).all.dirs.methods.include?(“each”)
p rio(’.’).all.dirs.methods.respond_to?(“each”)
false
true
I can call dirs.each, but I am trying to trace which .each method is
called in the rio source. Also how can I find the parent/superclass
class of a class? (ie. something like Array.parent?)
Les
On Apr 13, 2007, at 15:42 , Leslie V. wrote:
Hello!
Does anyone know the reason for the following?
p rio(’.’).all.dirs.methods.include?(“each”)
p rio(’.’).all.dirs.methods.respond_to?(“each”)
false
true
I think you meant:
p rio(’.’).all.dirs.respond_to?(“each”)
you don’t want to ask the result of methods if IT responds to each,
you want to ask the result of dirs.
I can call dirs.each, but I am trying to trace which .each method is
called in the rio source.
Don’t forget that things like method_missing (and even respond_to?)
can be overridden.
Also how can I find the parent/superclass
class of a class? (ie. something like Array.parent?)
Array.superclass
=> Object
Remember, ri is your friend, just ask it what you asked us and you’ll
often find your answer:
% ri superclass
------------------------------------------------------- Class#superclass
class.superclass -> a_super_class or nil
Returns the superclass of _class_, or +nil+.
File.superclass #=> IO
IO.superclass #=> Object
Object.superclass #=> nil
On 4/14/07, Ryan D. [email protected] wrote:
false
called in the rio source.
Remember, ri is your friend, just ask it what you asked us and you’ll
Object.superclass #=> nil
Thanks Ryan. It seems I am much more tired than I thought I was 