module IRS::Utils::AutoAddMethods

Public Instance Methods

singleton_method_added(symbol) click to toggle source

A handy bit of metaprogramming/monkeypatching that copies any `def self.method_name` into a `def method_name` so that the method can be called whether the class has been assigned to an object or not. You can use it by adding this line into your class: `extend IRS::Utils::AutoAddMethods`

# File lib/utils.rb, line 60
def singleton_method_added(symbol)
  define_method(symbol, method(symbol).to_proc)
end