Sha256: cff61fed7f8c82fb64825599bef935cb1b0de4f6ab86e8fb841b823231932295

Contents?: true

Size: 274 Bytes

Versions: 2

Compression:

Stored size: 274 Bytes

Contents

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.0.0 lib/inactive_support/object/identity.rb
inactive_support-0.1.0 lib/inactive_support/object/identity.rb