AFAIK I know these two ways of namespacing in ruby:
module Cat
class Lion
def hunt
p 'roaming for prey ...'
end
end
class Cheetah
def hunt
Lion.new.hunt
p 'Oops there is a lion. Hide first ...'
end
end
end
class Cat::MountainLion
def hunt
Lion.new.hunt
p 'roaming for prey ... (since I dont live in the same continent as lion)'
end
end
Cat::Cheetah.new.hunt
Cat::MountainLion.new.hunt
Why is it the Cat::MountainLion.new.hunt
doesn't work? Are namespace declared as module
differs to those declared as prefix to class class Cat::
?