class Array::Seq

Public Class Methods

new(array, offset = 0) click to toggle source
# File lib/apricot/ruby_ext.rb, line 54
def initialize(array, offset = 0)
  @array = array
  @offset = offset
end

Public Instance Methods

count() click to toggle source
# File lib/apricot/ruby_ext.rb, line 75
def count
  @array.length - @offset
end
each() { |x| ... } click to toggle source
# File lib/apricot/ruby_ext.rb, line 71
def each
  @array[@offset..-1].each {|x| yield x }
end
first() click to toggle source
# File lib/apricot/ruby_ext.rb, line 59
def first
  @array[@offset]
end
next() click to toggle source
# File lib/apricot/ruby_ext.rb, line 63
def next
  if @offset + 1 < @array.length
    Seq.new(@array, @offset + 1)
  else
    nil
  end
end
to_a() click to toggle source
# File lib/apricot/ruby_ext.rb, line 79
def to_a
  @array[@offset..-1]
end