Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/chitin/core_ext/object.rb
Instance Method Summary collapse
-
#[](*args) ⇒ Object
access private methods.
-
#bottle ⇒ Object
it does NOT return self, but rather the value of block.
Instance Method Details
#[](*args) ⇒ Object
access private methods
13 14 15 16 17 18 19 20 |
# File 'lib/chitin/core_ext/object.rb', line 13 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 |
#bottle ⇒ Object
it does NOT return self, but rather the value of block. if no block is given, it returns nil it’s the equivalent of ‘with(object=nil) {|obj| blah }`
6 7 8 9 10 |
# File 'lib/chitin/core_ext/object.rb', line 6 def bottle # since it's not tap if block_given? yield self end end |