Class: Zippo::IOZipMember
- Inherits:
-
Object
- Object
- Zippo::IOZipMember
- Defined in:
- lib/zippo/io_zip_member.rb
Overview
A zip member sourced from an IO object
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, source) ⇒ IOZipMember
constructor
A new instance of IOZipMember.
- #read ⇒ Object
- #write_to(out, preferred_compression_method = Filter::DeflateCompressor::METHOD, _recompress = nil) ⇒ Object
Constructor Details
#initialize(name, source) ⇒ IOZipMember
Returns a new instance of IOZipMember.
9 10 11 12 |
# File 'lib/zippo/io_zip_member.rb', line 9 def initialize(name, source) @name = name @source = source end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/zippo/io_zip_member.rb', line 7 def name @name end |
Instance Method Details
#read ⇒ Object
14 15 16 17 18 |
# File 'lib/zippo/io_zip_member.rb', line 14 def read @source.read ensure @source.rewind end |
#write_to(out, preferred_compression_method = Filter::DeflateCompressor::METHOD, _recompress = nil) ⇒ Object
20 21 22 |
# File 'lib/zippo/io_zip_member.rb', line 20 def write_to(out, preferred_compression_method = Filter::DeflateCompressor::METHOD, _recompress = nil) Filter::Compressor.for(preferred_compression_method).new(@source).compress_to(out) end |