Is it there a way to define a module callback similar to Module#included, but to be called after the receiver's definition is over ?
For example, in order to be able to access receiver's methods defined after the inclusion :
module A
def self.included(base)
if base.respond_to? :foo
puts ":foo is defined in #{base}"
else
puts ":foo is not defined in #{base}"
end
end
end
class B
include A
def self.foo ; end
end
# :foo is not defined in B
It is possible to include the module at the end of the receiver's definition, but it feels less idiomatic :
class C
def self.foo ; end
include A
end
# :foo is defined in C