Sha256: 61e0e2eabf998e2e59e90cb7ad37d5337eb897c36ef13d889844d22e4bf64c36
Contents?: true
Size: 607 Bytes
Versions: 1
Compression:
Stored size: 607 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hamster-1.0.1.pre.rc.1 | lib/hamster/tuple.rb |