Module: Prependable::Self

Defined in:
lib/core-uncommon/facets/module/prepend.rb

Instance Method Summary collapse

Instance Method Details

#method_added(meth) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/core-uncommon/facets/module/prepend.rb', line 15

def method_added(meth)
  return if meth.to_s[-2,2] == ':-'
  alias_method "#{meth}:-", meth
  remove_method(meth)
  prepend_module.module_eval %{
    def #{meth}(*a,&b); __send__("#{meth}:-",*a,&b); end
  }
  include prepend_module
end

#prepend_moduleObject



11
12
13
# File 'lib/core-uncommon/facets/module/prepend.rb', line 11

def prepend_module
  @_prepend_module ||= Module.new
end