From: Yohanes Santoso Date: 2002-02-23T10:20:42+09:00 Subject: Re: recursive require --=-=-= "Pit Capitain" writes: > On 22 Feb 2002, at 19:59, Yohanes Santoso wrote: > > jenny:~/tmp> ruby abc.rb > > abc knows xyz: > > Xyz > > abc tells the truth > > jenny:~/tmp> ruby xyz.rb > > xyz knows abc: > > Abc > > xyz tells the truth > > If you carefully look at the output, you'll notice that "Xyz" and "Abc" > are printed with uppercase letters. So it's not the method "name" Duh. I plead ignorance. Attached is the correct implementation. This time the result is: jenny:~/tmp> ruby xyz.rb xyz knows abc: static method of abc nonstatic method of abc xyz tells the truth jenny:~/tmp> ruby abc.rb abc knows xyz: static method of xyz nonstatic method of xyz abc tells the truth YS. --=-=-= Content-Disposition: attachment; filename=global.rb Content-Description: global.rb class Abc end class Xyz end --=-=-= Content-Disposition: attachment; filename=abc.rb Content-Description: abc.rb require 'global' require 'xyz' class Abc def Abc.Static "static method of abc" end def nonstatic "nonstatic method of abc" end def whoami puts "abc knows xyz:" puts Xyz.Static puts Xyz.new.nonstatic puts "abc tells the truth" end end if __FILE__ == $0 a = Abc.new a.whoami end --=-=-= Content-Disposition: attachment; filename=xyz.rb Content-Description: xyz.rb require 'global' require 'abc' class Xyz def Xyz.Static "static method of xyz" end def nonstatic "nonstatic method of xyz" end def whoami puts "xyz knows abc:" puts Abc.Static puts Abc.new.nonstatic puts "xyz tells the truth" end end if __FILE__ == $0 x = Xyz.new x.whoami end --=-=-=--