class ArcFurnace::EnumeratorSource

Attributes

value[R]

Public Class Methods

new() click to toggle source
# File lib/arc-furnace/enumerator_source.rb, line 9
def initialize
  @enumerator = build_enumerator
  preprocess
  advance
end

Public Instance Methods

advance() click to toggle source
# File lib/arc-furnace/enumerator_source.rb, line 26
def advance
  @value =
    begin
      enumerator.next if enumerator
    rescue StopIteration
      @enumerator = nil
      nil
    end
end
empty?() click to toggle source

Is this source empty?

# File lib/arc-furnace/enumerator_source.rb, line 22
def empty?
  !value
end
preprocess() click to toggle source

Called after setting up the enumerator but before advancing it Use this to extract header rows for instance.

# File lib/arc-furnace/enumerator_source.rb, line 17
def preprocess
  # nothing
end

Protected Instance Methods

build_enumerator() click to toggle source

Return the enumerator

# File lib/arc-furnace/enumerator_source.rb, line 39
def build_enumerator
  raise "Unimplemented"
end