Sha256: a8d358a6989f69a14ed45ca1217018314e470fb8a2265f82df6eacabb5bcfbf3
Contents?: true
Size: 919 Bytes
Versions: 1
Compression:
Stored size: 919 Bytes
Contents
module Rupture class ArraySeq < Seq def initialize(array, index = 0) @array = array @index = index super() end def first @array[@index] end def rest ArraySeq.new(@array, @index.inc) end def seq self if @index < @array.size end def size @array.size - @index end end class RArraySeq < ArraySeq def initialize(array, index = array.size - 1) super(array, index) end def rest RArraySeq.new(@array, @index.dec) end def seq self if @index >= 0 end def size @index.inc end end module ArraySeqable def seq Rupture::ArraySeq.new(self).seq end def rseq Rupture::RArraySeq.new(self).seq end def not_empty self if seq end end end class Array include Rupture::ArraySeqable end class String include Rupture::ArraySeqable end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rupture-0.1.0 | lib/rupture/array_seq.rb |