Module: TapUnless

Defined in:
lib/tap_unless.rb

Instance Method Summary collapse

Instance Method Details

#tap_unless(*args) {|_self| ... } ⇒ Object

See TapIf

Yields:

  • (_self)

Yield Parameters:

  • _self (TapUnless)

    the object that the method was called on



5
6
7
8
9
# File 'lib/tap_unless.rb', line 5

def tap_unless(*args)
  yield self if ((args.empty? && !self) || (args.any? && respond_to?(args.first) && !send(*args)))
  #
  self
end