Class: Zip::PassThruCompressor

Inherits:
Compressor show all
Defined in:
lib/zip/pass_thru_compressor.rb

Overview

:nodoc:all

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Compressor

#finish

Constructor Details

#initialize(output_stream) ⇒ PassThruCompressor

Returns a new instance of PassThruCompressor.



5
6
7
8
9
10
# File 'lib/zip/pass_thru_compressor.rb', line 5

def initialize(output_stream)
  super()
  @output_stream = output_stream
  @crc = Zlib.crc32
  @size = 0
end

Instance Attribute Details

#crcObject (readonly)

Returns the value of attribute crc.



19
20
21
# File 'lib/zip/pass_thru_compressor.rb', line 19

def crc
  @crc
end

#sizeObject (readonly)

Returns the value of attribute size.



19
20
21
# File 'lib/zip/pass_thru_compressor.rb', line 19

def size
  @size
end

Instance Method Details

#<<(data) ⇒ Object



12
13
14
15
16
17
# File 'lib/zip/pass_thru_compressor.rb', line 12

def <<(data)
  val = data.to_s
  @crc = Zlib.crc32(val, @crc)
  @size += val.bytesize
  @output_stream << val
end