[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

easy question: access module/class outside of current scope

bwv549

9/6/2007 7:00:00 PM

I've seen someone do this, but I forget how it is done and I can't
find it by searching...

module Dog
def self.new
puts 'ruff ruff'
end
end

class Crazy
class Dog
def some_method
mydog = Dog.new # I want the module Dog and not the class Dog
that I'm in...
end
end
end

# What is the nomenclature to get at the module Dog above and not the
Dog class I'm inside?

Thanks

1 Answer

Carlos

9/6/2007 7:53:00 PM

0

[bwv549 <jtprince@gmail.com>, 2007-09-06 21.05 CEST]
> I've seen someone do this, but I forget how it is done and I can't
> find it by searching...
>
> module Dog
> def self.new
> puts 'ruff ruff'
> end
> end
>
> class Crazy
> class Dog
> def some_method
> mydog = Dog.new # I want the module Dog and not the class Dog
> that I'm in...
> end
> end
> end
>
> # What is the nomenclature to get at the module Dog above and not the
> Dog class I'm inside?

::Dog

> Thanks

You're welcome ;).
--