Module: CoreEx::Module::InPlace

Included in:
Module
Defined in:
lib/core_ex/module/in_place.rb

Instance Method Summary collapse

Instance Method Details

#in_place(*syms) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/core_ex/module/in_place.rb', line 12

def in_place ( *syms )
  syms.each do |sym|
    sym = sym.to_s.sub(/!*$/, '')
    module_eval "
      def #{sym} ( *a, &b )
        dup.#{sym}!(*a, &b)
      end
    "
  end
end