C
Chris
<RubyNubyAlert>
Doing my best to convert from Perl to Ruby, and mainly loving every
minute of it.
But I have a question about Modules... Why when I declare a Module, do
I have to prefix all the routines in that module with the module name
(or routines outside the module don't see it)? I don't get that?
Isn't this kind of redundant? For instance, I can't do this:
Module Foo
def bar
"bar"
end
end
puts Foo.bar
I have to do this:
Module Foo
def Foo.bar
"bar"
end
end
What's up with that? Seems redundant to me. (Oh, I already said
that!) But I thought I would ask. Maybe there is a good reason
for this? Or, maybe there is a way around this?
</RubyNubyA;ert>
Thanks!
-ceo
Doing my best to convert from Perl to Ruby, and mainly loving every
minute of it.
But I have a question about Modules... Why when I declare a Module, do
I have to prefix all the routines in that module with the module name
(or routines outside the module don't see it)? I don't get that?
Isn't this kind of redundant? For instance, I can't do this:
Module Foo
def bar
"bar"
end
end
puts Foo.bar
I have to do this:
Module Foo
def Foo.bar
"bar"
end
end
What's up with that? Seems redundant to me. (Oh, I already said
that!) But I thought I would ask. Maybe there is a good reason
for this? Or, maybe there is a way around this?
</RubyNubyA;ert>
Thanks!
-ceo