easy question: access module/class outside of current scope

B

bwv549

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
 
C

Carlos

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 ;).
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top