How do I include a module in a namespaced class?
Posted
by snl
on Stack Overflow
See other posts from Stack Overflow
or by snl
Published on 2010-03-26T16:52:20Z
Indexed on
2010/03/26
16:53 UTC
Read the original article
Hit count: 306
ruby
I am having trouble including a module in a namespaced class. The example below throws the error uninitialized constant Bar::Foo::Baz (NameError)
. What basic piece of Ruby knowledge am I missing here?
module Foo
module Baz
def hello
puts 'hello'
end
end
end
module Bar
class Foo
include Foo::Baz
end
end
foo = Bar::Foo.new
© Stack Overflow or respective owner