Module: Gemmy::Patches::ObjectPatch::InstanceMethods::Ergo

Defined in:
lib/gemmy/patches/object_patch.rb

Instance Method Summary collapse

Instance Method Details

#ergo(&b) ⇒ Object

facets This is like #tap, but #tap yields self and returns self, where as #ergo yields self but returns the result.



174
175
176
177
178
179
180
# File 'lib/gemmy/patches/object_patch.rb', line 174

def ergo(&b)
  if block_given?
    b.arity > 0 ? yield(self) : instance_eval(&b)
  else
    self
  end
end