From: Florian Frank Date: 2006-11-27T08:05:11+09:00 Subject: Re: Extremely Noobish Documentation Question Patrick McNally schrieb: >> open methed is a method defined in kernel module >> > > Thank you for the quick response. This answer was not correct. You cannot find the File.open method, because there is none. It is inherited from the IO class, because File < IO == true. If you want to find out where a method is located you can type this into irb: >> File.method(:open) # => # This shows the inheritance relation. Ruby's rdoc/ri is a bit stupid, and can't locate inherited methods so well. There is also a Kernel#open method, that is mixed into the Object class as a private method. This makes it possible to open a file by calling open(filename) do |file| #... end from everywhere. If you call File.open this isn't the method called, because IO#open is found first: >> require 'pp'; pp File.ancestors.map { |klass| [ klass, klass.method(:open) ] } [[File, #], [IO, #], [File::Constants, #], [Enumerable, #], [Object, #], [PP::ObjectMixin, #], [Kernel, #]] You can call Kernel#open only without an explicit receiver, because it is private. That's why calling, e. g., Array.open would fail with a NoMethodError. -- Florian Frank