Class: Class

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

Instance Method Summary collapse

Instance Method Details

#def_each(*method_names, &block) ⇒ Object

Easily add multiple methods that do the same thing.



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

def def_each(*method_names, &block)
  method_names.each do |method_name|
    define_method method_name do
      instance_exec method_name, &block
    end
  end
end