Sha256: 93803c244d4f934d900e0bf4109011e1092b531030f0ab172c39b538e1fce30c
Contents?: true
Size: 742 Bytes
Versions: 3
Compression:
Stored size: 742 Bytes
Contents
module Rupture class Seq include Enumerable include Sequence def inspect "(#{to_a.collect(&:inspect).join(',')})" end def [](index) nth(index) end def to_ary to_a end def eql?(other) return false unless other.respond_to?(:seq) s = self.seq o = other.seq while s && o return false if s.first != o.first s = s.next o = o.next end s.nil? and o.nil? end alias == eql? class EmptySeq < Seq def seq nil end end Empty = EmptySeq.new end end class NilClass include Rupture::Sequence def seq nil end def first nil end def rest Rupture::Seq::Empty end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rupture-0.3.0 | lib/rupture/seq.rb |
rupture-0.2.1 | lib/rupture/seq.rb |
rupture-0.2.0 | lib/rupture/seq.rb |