Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/domesticate_monkeys/initializers/module.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.singleton_method_added(_method) ⇒ Object



24
25
26
27
# File 'lib/domesticate_monkeys/initializers/module.rb', line 24

def self.singleton_method_added(_method)
  unbound_method = self.method(_method)
  DomesticateMonkeys::Track.add(unbound_method, :singleton)
end

Instance Method Details

#method_added(_method) ⇒ Object

Although ‘the earlier, the better’ does definitely apply, this should, in any case, happen BEFORE the initialization of Rails and all other gems. The reason being that we can only track redefinitions of methods defined in gems, such as Rails, if we first are able to built a Track for that method’s orignal definition.



19
20
21
22
# File 'lib/domesticate_monkeys/initializers/module.rb', line 19

def method_added(_method)
  unbound_method = self.instance_method(_method)
  DomesticateMonkeys::Track.add(unbound_method, :instance)
end