Sha256: 1bcaf50357ba563cb2caf04f442da93fa03cd69f852cdfd01dcb7b653faf1f63

Contents?: true

Size: 290 Bytes

Versions: 2

Compression:

Stored size: 290 Bytes

Contents

# encoding: utf-8
class Object
  # Returns self. If given a block, it works a lot like Object#tap
  #
  # ==== Examples
  #
  #   [1,2,3,5,7].consecutive_by(&:identity)
  #   => [[1, 2, 3], [5], [7]]
  def identity
    if block_given?
      yield self
    else
      self
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inactive_support-1.3.0 lib/inactive_support/object/identity.rb
inactive_support-1.2.0 lib/inactive_support/object/identity.rb