From: Ryan Davis Date: 2007-04-14T07:50:15+09:00 Subject: Re: Invisible methods and inheritance On Apr 13, 2007, at 15:42 , Leslie Viljoen 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