Class: Zip::PassThruCompressor
- Inherits:
-
Compressor
- Object
- Compressor
- Zip::PassThruCompressor
- Defined in:
- lib/zip/pass_thru_compressor.rb
Overview
:nodoc:all
Instance Attribute Summary collapse
-
#crc ⇒ Object
readonly
Returns the value of attribute crc.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #<<(data) ⇒ Object
-
#initialize(outputStream) ⇒ PassThruCompressor
constructor
A new instance of PassThruCompressor.
Methods inherited from Compressor
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
#crc ⇒ Object (readonly)
Returns the value of attribute crc.
17 18 19 |
# File 'lib/zip/pass_thru_compressor.rb', line 17 def crc @crc end |
#size ⇒ Object (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 |