Class: Object

Inherits:
BasicObject
Defined in:
lib/chitin/core_ext/object.rb

Instance Method Summary collapse

Instance Method Details

#[](*args) ⇒ Object

access private methods



12
13
14
15
16
17
18
19
# File 'lib/chitin/core_ext/object.rb', line 12

def [](*args)
  if method(args.first)
    method(args.first).call *args[1..-1]
  else
    raise NoMethodError.new("undefined method" +
                            "`#{args.first}' for #{self}:#{self.class}")
  end
end

#bottleObject

it does NOT return self, but rather the value of block. if no block is given, it returns nil



5
6
7
8
9
# File 'lib/chitin/core_ext/object.rb', line 5

def bottle # since it's not tap
  if block_given?
    yield self
  end
end