The example code and output can be found here:
module A
def self.included(base)
base.include InMethods
end
module InMethods
def mem
@mem ||= []
end
def add(n)
mem += n
end
end
end
class Help
include A
end
h = Help.new
h.add(1)
# in `add': undefined method `+' for nil:NilClass (NoMethodError)
Basically, I am included one module which includes a submodule, but the real problem is with the methods and the instance variable. this is a common pattern for me, but since i am trying to do it from a module i've included, i'm having trouble.