Module: Tappie

Included in:
Object
Defined in:
lib/tappie.rb

Instance Method Summary collapse

Instance Method Details

#tap(&block) ⇒ Object

taps and returns the object itself.

if the block has arity one, the object will be passed as an argument. if the block has no arity, the object is the scope (old style). if there is no block, just taps (why, why?).



8
9
10
11
12
13
14
15
16
17
# File 'lib/tappie.rb', line 8

def tap(&block)
  if block_given?
    if block.arity==1
      yield self
    else
      self.instance_eval(&block)
    end
  end
  self
end