From: Dave Thomas Date: 2001-08-31T22:58:50+09:00 Subject: [ruby-talk:20628] Re: Weird things with eval Paul Brannan writes: > Why, though, if I do: > > class Foo > end > > def bar > puts 'bar' > end > > Foo.bar > > do I get: > > NameError: private method `bar' called for Foo:Class Because a bare method definition makes 'bar' a private method of Object. Object is a parent of Foo, so when you call Foo.bar, it finds it, but then can't use it. Try def fred end p Object.private_instance_methods This is one of the very clever things in Ruby: getting the semantics of conventional procedures without breaking the OO paradigm. Dave