Module: Added
- Included in:
- Module
- Defined in:
- lib/added/version.rb,
lib/added/implementation.rb
Constant Summary collapse
- VERSION =
"1.0.2"
Instance Method Summary collapse
- #extended(instance) ⇒ Object
- #included(klass) ⇒ Object (also: #prepended)
Instance Method Details
#extended(instance) ⇒ Object
2 3 4 5 |
# File 'lib/added/implementation.rb', line 2 def extended(instance) super added(instance) if respond_to? :added end |
#included(klass) ⇒ Object Also known as: prepended
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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 |