Module: Ragot::RagotInside
- Defined in:
- lib/ragot.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(klass) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/ragot.rb', line 23 def self.extended(klass) unless klass.respond_to?(:after, true) || klass.respond_to?(:before, true) klass.singleton_class.send :alias_method, :before, :declare_ragot klass.singleton_class.send :alias_method, :after, :declare_ragot end end |
Instance Method Details
#method_added(meth) ⇒ Object
36 37 38 |
# File 'lib/ragot.rb', line 36 def method_added(meth) Declaration.for(self).trigger meth end |
#singleton_method_added(meth) ⇒ Object
30 31 32 33 34 |
# File 'lib/ragot.rb', line 30 def singleton_method_added(meth) if method(meth).owner != Ragot::RagotInside && %i|before after|.include?(meth) singleton_class.send :remove_method, (%i|before after| - [meth]).first end end |