Class: Schlepp::Sink::TableObject::Compressor::Writer

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Writer.



8
9
10
11
12
# File 'lib/schlepp/sink/filter/compressor/writer.rb', line 8

def initialize(writer, opts = {})
  @stream = Stream.new
  @writer = writer
  @written = 0
end

Instance Method Details

#finalizeObject



26
27
28
29
30
31
# File 'lib/schlepp/sink/filter/compressor/writer.rb', line 26

def finalize
  bits = @stream.to_s

  @writer.write(bits)
  @writer.finalize
end

#rotate?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/schlepp/sink/filter/compressor/writer.rb', line 22

def rotate?
  false
end

#write(rows) ⇒ Object



14
15
16
17
18
19
# File 'lib/schlepp/sink/filter/compressor/writer.rb', line 14

def write(rows)
  Array(rows).each do |row|
    @written += row.length
    @stream.write(row)
  end
end