class Schlepp::Sink::TableObject::Carosel
Public Class Methods
new(factory, chain)
click to toggle source
# File lib/schlepp/sink/table_object/carosel.rb, line 8 def initialize(factory, chain) @factory = factory @chain = chain @parts = [] @current = rotate @finalized = false end
Public Instance Methods
finalize()
click to toggle source
# File lib/schlepp/sink/table_object/carosel.rb, line 29 def finalize @current.finalize @finalized = true @parts end
write(data)
click to toggle source
# File lib/schlepp/sink/table_object/carosel.rb, line 16 def write(data) raise_if_finalized if rotate?(data) rotate if rotate?(data) raise end end Array(data).each do |r| @current.write(r) end end
Private Instance Methods
raise_if_finalized()
click to toggle source
# File lib/schlepp/sink/table_object/carosel.rb, line 37 def raise_if_finalized @finalized && raise end
rotate()
click to toggle source
# File lib/schlepp/sink/table_object/carosel.rb, line 45 def rotate @current.finalize if @current to = table_object_factory.new @parts << to builder = Schlepp::Sink::TableObject::Writer::Factory.new(@factory, @chain, to) @current = builder.new end
rotate?(data)
click to toggle source
# File lib/schlepp/sink/table_object/carosel.rb, line 41 def rotate?(data) @chain.any?(&:should_rotate?) end
table_object_factory()
click to toggle source
# File lib/schlepp/sink/table_object/carosel.rb, line 59 def table_object_factory @table_object_factory ||= Schlepp::Sink::TableObject::Factory.new(@factory, @chain) end