Sha256: 3a8319f48786b67ac9bee5d315a09a4953d47fd538607510a09662e5cd9e75bc
Contents?: true
Size: 613 Bytes
Versions: 10
Compression:
Stored size: 613 Bytes
Contents
require 'forwardable' require 'hamster/immutable' module Hamster class Tuple extend Forwardable include Immutable def initialize(*items) @items = items.freeze end def first @items.first end def last @items.last end def eql?(other) return true if other.equal?(self) instance_of?(other.class) && @items.eql?(other.instance_variable_get(:@items)) end def_delegator :self, :eql?, :== def to_ary @items end def to_a @items.dup end def inspect "(#{@items.inspect[1..-2]})" end end end
Version data entries
10 entries across 10 versions & 1 rubygems