Hello,
Is there a short cut for:
module A; module B; module C; module D
def D.f
end
end; end; end; end
The following doesn’t work for me:
module A::C:
def D.f
end
end
Thanks
-John
Hello,
Is there a short cut for:
module A; module B; module C; module D
def D.f
end
end; end; end; end
The following doesn’t work for me:
module A::C:
def D.f
end
end
Thanks
-John
On 10/9/06, John Ky [email protected] wrote:
module A::C:
def D.f
end
end
That will work if A::C exist.
-austin
Hi Austin,
This code doesn’t work either:
module A; module B; module C
end; end; endmodule A::C:
def D.f
end
end
testns.rb:5: uninitialized constant A::C::D: (NameError)
Thanks
-John
On 09/10/06, John Ky [email protected] wrote:
end
testns.rb:5: uninitialized constant A::C::D: (NameError)
It’s the presence of D in the method name that’s the problem; any of
these will work:
module A::C:
def self.f
puts ‘foo’
end
end
module A::C:
def f
puts ‘foo’
end
module_function :f
end
module A::C:
def f
puts ‘foo’
end
extend self
end
Paul.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs