From: Sean O'Halpin Date: 2012-08-05T05:05:10+09:00 Subject: Re: Why does it fail? def Module1::Module2.hello On Sat, Aug 4, 2012 at 7:07 PM, Iņaki Baz Castillo wrote: > 2012/8/4 William Herry : >> I know one way to define module method >> >> module Module1::Module2 >> def self.hello >> puts 'HELLO' >> end >> end > > Sure, but what I ask is why this works: > > def Module1.hello ; end > > end this fails: > > def Module1::Module2.hello ; end > > > > -- > Iņaki Baz Castillo > > As Sigurd has pointed out, it's a syntax precedence thing. You can do this however: def (Module1::Module2).hello puts "HELLO" end Regards, Sean