Class: Schlepp::Sink::TableObject::Filter::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/schlepp/sink/table_object/filter/writer.rb

Instance Method Summary collapse

Constructor Details

#initialize(writer, observer, opts = {}) ⇒ Writer

Returns a new instance of Writer.



6
7
8
9
# File 'lib/schlepp/sink/table_object/filter/writer.rb', line 6

def initialize(writer, observer, opts = {})
  @writer = writer
  @observer = observer
end

Instance Method Details

#finalizeObject



18
19
20
21
# File 'lib/schlepp/sink/table_object/filter/writer.rb', line 18

def finalize
  @writer.finalize
  @observer.reset
end

#write(rows) ⇒ Object



11
12
13
14
15
16
# File 'lib/schlepp/sink/table_object/filter/writer.rb', line 11

def write(rows)
  Array(rows).each do |row|
    @writer.write(row)
    @observer.add(row)
  end
end