Forum: Ruby Double colon in class definition?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B199c6556fec872d272086be15c5e4ab?d=identicon&s=25 Robert La ferla (rlaferla)
on 2007-06-29 05:03
(Received via mailing list)
What does the double colon mean in a class definition.  e.g.
ActiveRecord::Base ?  I couldn't locate it in the docs.   I suspect
it's akin to a category or a namespace.  The only documentation on
double-colon that I have found indicates that "::" is used to make
class methods easier to read since "." will also call a class method.
Bc8e3e2f7acb3a7d93c10e235dc0b4e1?d=identicon&s=25 yermej@gmail.com (Guest)
on 2007-06-29 06:26
(Received via mailing list)
On Jun 28, 10:02 pm, Robert La Ferla <robertlafe...@comcast.net>
wrote:
> What does the double colon mean in a class definition.  e.g.
> ActiveRecord::Base ?  I couldn't locate it in the docs.   I suspect
> it's akin to a category or a namespace.  The only documentation on
> double-colon that I have found indicates that "::" is used to make
> class methods easier to read since "." will also call a class method.

In this case, it indicates that Base is a class within the
ActiveRecord module. More generally, it's used to reference a constant
(modules & classes are constants) within a module (similar to a
namespace) or a class. As in:

irb> Object::Fixnum.class
=> Class
irb> Object::RUBY_VERSION.class
=> String
This topic is locked and can not be replied to.