In Ruby, what's the correct way for a 'child' module to inherit attributes from a 'parent' module? It seems that if you define an attribute in one module and then extend that module and mixin the child module to a class, I should be able to access the attribute from the child module, but not having any luck...
module A
attr_accessor :foo
end
module B
extend A
def not_worky
p "#{foo}"
end
end
class C
include B
end
class D
include A
end
irb(main):027:0* d = D.new
irb(main):028:0> d.foo=> nil
irb(main):033:0* c = C.new
irb(main):034:0> c.foo
NoMethodError: undefined method `foo' for #<C:0x553853eb>
irb(main):038:0> c.not_worky
NameError: undefined local variable or method `foo' for #<C:0x553853eb>