Module: IRS::Utils::AutoAddMethods
- Included in:
- Ripper
- Defined in:
- lib/utils.rb
Instance Method Summary collapse
-
#singleton_method_added(symbol) ⇒ Object
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.
Instance Method Details
#singleton_method_added(symbol) ⇒ Object
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`
60 61 62 |
# File 'lib/utils.rb', line 60 def singleton_method_added(symbol) define_method(symbol, method(symbol).to_proc) end |