Where are methods defined at the ruby top level?
问题 At the top level, method definition should result in private methods on Object , and tests seem to bear this out: def hello; "hello world"; end Object.private_instance_methods.include?(:hello) #=> true Object.new.send(:hello) #=> "hello world" However, the following also works at top level ( self.meta is the eigenclass of main ): self.meta.private_instance_methods(false).include?(:hello) #=> true It appears that the hello method is simultaneously defined on the eigenclass of main as well as