Note, also, that if you don't wrap it in 'class Foo; end', you don't have access to the class @@variables of Foo. Devin > Jacob Fugal wrote: > > On 7/4/05, Robert Klemme <bob.news / gmx.net> wrote: > >> class Foo > >> def Foo.bar1() "bar1" end > >> > > Note that the last form (class << Foo) doesn't need to be inside the > > reopened class: > > > > $ cat > a.rb > > class Foo; end > > > > class << Foo > > def test > > puts "Hello, world!" > > end > > end > > > > Foo.test > > > > $ ruby a.rb > > Hello, world! > > The same is true for variant 1 also. I prefer the nested versions with > "self" because they are immune to name changes of the class.