Skip to content
  • Ufuk Kayserilioglu's avatar
    73b6000c
    Call `super` from `method_added`/`singleton_method_added` methods · 73b6000c
    Ufuk Kayserilioglu authored
    If a `method_added`/`singleton_method_added` method on a constant doesn't call `super` then none of the `method_added`/`singleton_method_added` methods on ancestors of the constant ever get called by Ruby.
    
    This breaks any code that might want to instrument classes to collect method definition locations, or to do other things when methods are added.
    
    In order to be a good citizen, it is best practice to call `super` from these methods.
    73b6000c
    Call `super` from `method_added`/`singleton_method_added` methods
    Ufuk Kayserilioglu authored
    If a `method_added`/`singleton_method_added` method on a constant doesn't call `super` then none of the `method_added`/`singleton_method_added` methods on ancestors of the constant ever get called by Ruby.
    
    This breaks any code that might want to instrument classes to collect method definition locations, or to do other things when methods are added.
    
    In order to be a good citizen, it is best practice to call `super` from these methods.
Loading