Forum: Ruby different between Door::new and

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
83a839c03c23af315efd9892f9a186e7?d=identicon&s=25 Ming en Chia (chiamingen)
on 2007-04-08 07:55
may i know what is the different between  Door::new and
i seem to work the same.
E0ed615bd6632dd23165e045e3c1df09?d=identicon&s=25 Florian Gross (Guest)
on 2007-04-08 13:25
(Received via mailing list)
The :: operator and the . operator only behave differently when
constants are involved AFAIK.

Foo::Bar will only look for the constant and raise an exception
Foo::Bar() and Foo::Bar X will only look for a method.
Foo.Bar will only look for a method.

Otherwise the :: operator is equivalent to the . operator, even for
non-module/class objects:

5::to_s # => "5"
5::+ 6 # => 11
This topic is locked and can not be replied to.