Something that is called when it is extended.
Eg. this piece of code:
module M
def init(x)
@x = 5
self
end
def foo
super
puts @x
end
end
class D
def foo
puts 1
end
end
D.new.extend(M).init(5).foo
works and returns 1 5. But I want to change the last line to read
D.new.extend(M.init(5)).foo
or better yet
D.new.extend(M(5)).foo
to prevent bugs from not setting @x.
On a similar note, can I say something like
class X
include Debug(5)
You can do that by having a method that returns a Module.