Is there any clean way to initialize instance variables in a Module intended to be used as Mixin? For example, I have the following:
module Example def on(..
Perhaps this is a little hacky, but you can use prepend to get the desired behavior:
prepend
module Foo def initialize(*args) @instance_var = [] super end end class A prepend Foo end
Here is the output from the console:
2.1.1 :011 > A.new => #