Module: Anachronic::Override
- Included in:
- Anachronic
- Defined in:
- lib/anachronic/override.rb
Overview
Takes over a method and renames original method for later use
Instance Method Summary collapse
Instance Method Details
#async(method_name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/anachronic/override.rb', line 6 def async(method_name) new_name = "anachronic__#{method_name}".to_sym alias_method new_name, method_name undef_method method_name define_method(method_name) do |*args| BackgroundExecutor.call(self, new_name, *args) end end |