Class: Object

Inherits:
BasicObject
Defined in:
lib/couch/extras.rb

Instance Method Summary collapse

Instance Method Details

#define_instance_method(sym, *args, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/couch/extras.rb', line 2

def define_instance_method(sym, *args, &block)
  if args.empty?
    singleton_class.send(:define_method, sym, &block)
  else
    invalid_argument! if block_given?
    r = args.first
    singleton_class.send(:define_method, sym) do r end
  end
  self
end