module Added

Constants

VERSION

Public Instance Methods

extended(instance) click to toggle source
Calls superclass method
# File lib/added/implementation.rb, line 2
def extended(instance)
  super
  added(instance) if respond_to? :added
end
included(klass) click to toggle source
Calls superclass method
# File lib/added/implementation.rb, line 7
def included(klass)
  super
  if respond_to? :added
    mod = self
    klass.send(:prepend, Module.new{
      define_method(:initialize){ |*args, &block|
        super(*args, &block)
        mod.added(self)
      }
    })
    ObjectSpace.each_object(klass){ |instance|
      added(instance)
    }
  end
end
Also aliased as: prepended
prepended(klass)
Alias for: included