From: matt@... (matt neuburg) Date: 2006-11-27T08:15:09+09:00 Subject: Re: Extremely Noobish Documentation Question Paco Paco wrote: > In many examples I have seen File.open used > but when I refer to the official documentation > (http://www.ruby-doc.org/core/) the 'open' method is not listed for the > File class. Isn't the problem here that the File class inherits from the IO class? IO has an open method, therefore File has an open method. But you have to look under IO to see it. It might be helpful to have on hand a script that reports a class's methods by cycling up the inheritance chain for you: def method_report(klass) result = klass.ancestors.inject(Array.new) do |result, anc| ms = (anc.instance_methods + anc.methods).sort.uniq result.last[1] -= ms if result.last result << [anc.name, ms] end result.each do |k, v| puts "----", k v.each {|m| puts "\s\s#{m}"} end end # and here's how to use it method_report(File) m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Tiger - http://www.takecontrolbooks.com/tiger-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com