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(outputStream) ⇒ PassThruCompressor

Returns a new instance of PassThruCompressor.



3
4
5
6
7
8
# File 'lib/zip/pass_thru_compressor.rb', line 3

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

Instance Attribute Details

#crcObject (readonly)

Returns the value of attribute crc.



17
18
19
# File 'lib/zip/pass_thru_compressor.rb', line 17

def crc
  @crc
end

#sizeObject (readonly)

Returns the value of attribute size.



17
18
19
# File 'lib/zip/pass_thru_compressor.rb', line 17

def size
  @size
end

Instance Method Details

#<<(data) ⇒ Object



10
11
12
13
14
15
# File 'lib/zip/pass_thru_compressor.rb', line 10

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