Module: Outbox::DefineInheritableMethod

Defined in:
lib/outbox/define_inheritable_method.rb

Instance Method Summary collapse

Instance Method Details

#define_inheritable_method(mod_name, *args, &block) ⇒ Object

Similar to .define_method, but adds a dynamic module in the inheritance change to attach the method to. See:

thepugautomatic.com/2013/07/dsom/



7
8
9
10
11
12
# File 'lib/outbox/define_inheritable_method.rb', line 7

def define_inheritable_method(mod_name, *args, &block)
  mod = get_inheritable_module(mod_name)
  mod.module_eval do
    define_method(*args, &block)
  end
end