Learning newb: regaring methods and class methods

hi, i just need to know if i'm on the right trax regarding ruby:

a '::' method class attached to another constant or variable will tell
that constant/variable to use all methods under it's class where

as '.' tells ruby to use only 1 method.

but before using that method, we have to call for the 'new class' that
method belongs to...

Can someone please tell me if any of the above is wrong?

thanks

···

--
Posted via http://www.ruby-forum.com/.

Hi --

hi, i just need to know if i'm on the right trax regarding ruby:

a '::' method class attached to another constant or variable will tell
that constant/variable to use all methods under it's class where

as '.' tells ruby to use only 1 method.

but before using that method, we have to call for the 'new class' that
method belongs to...

Can someone please tell me if any of the above is wrong?

:: is chiefly for navigating paths through nested classes and modules:

   class A
     module B
       class C
       end
     end
   end

. is for calling methods -- like C.new, above.

You'll sometimes see :: used for calling methods when the receiver is
a class or module, but personally I think it's simpler and clearer just
to use . for calling methods.

David

···

On Thu, 13 Jul 2006, Dominic Son wrote:
   A::b::C.new # new instance of the inner class

--
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
Ruby for Rails => RUBY FOR RAILS, the Ruby book for
                                                     Rails developers
http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log
dblack@wobblini.net => me