Sha256: 064eba79c39e98e7a12a62a7f3b8e64e76fdfdc4a00a92041633a45946037604

Contents?: true

Size: 441 Bytes

Versions: 4

Compression:

Stored size: 441 Bytes

Contents

require 'forwardable'

module Hamster

  class Tuple

    extend Forwardable

    def initialize(*items)
      @items = items.freeze
    end

    def first
      @items.first
    end

    def last
      @items.last
    end

    def dup
      self
    end
    def_delegator :self, :dup, :clone

    def to_ary
      @items
    end

    def to_a
      @items.dup
    end

    def inspect
      "(#{@items.inspect[1..-2]})"
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hamster-0.2.5 lib/hamster/tuple.rb
hamster-0.2.4 lib/hamster/tuple.rb
hamster-0.2.3 lib/hamster/tuple.rb
hamster-0.2.2 lib/hamster/tuple.rb