Class: Class

Inherits:
Object
  • Object
show all
Defined in:
lib/override.rb

Overview

Instance Method Summary collapse

Instance Method Details

#override(*names) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/override.rb', line 3

def override(*names)
  mod = Module.new
  names.each do |name|
    method = self.instance_method(name.to_sym)
    mod.module_eval { send(:define_method, name.to_sym, method) }
    include mod
  end
end