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(output_stream) ⇒ PassThruCompressor
constructor
A new instance of PassThruCompressor.
Methods inherited from Compressor
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
#crc ⇒ Object (readonly)
Returns the value of attribute crc.
19 20 21 |
# File 'lib/zip/pass_thru_compressor.rb', line 19 def crc @crc end |
#size ⇒ Object (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 |