From: Rick DeNatale Date: 2010-02-04T03:25:39+09:00 Subject: Re: Referencing a method in a module On Wed, Feb 3, 2010 at 10:13 AM, Charles Roper wrote: > On 03/02/2010 11:37, Farrel Lifson wrote: >> >> Foo#bar is usually used for instance methods, Foo.bar for class >> methods. In this case I think Foo#bar is correct. > > Ah, yes, I think I've seen that. And so Foo::Bar would be for a class within > a module? More generally Foo::Bar refers to the constant named Bar within the namespace named Foo. Foo could be either a Module or a Class The value of Bar could be a Module, a Class, or actually any value module Foo class Bar Baz = 42 end module ClassMethods end end Foo is a module here, Foo::Bar is a class Foo::ClassMethods is a module Foo:Bar::Baz is an integer. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale