Class: Officedoc::Package::Raw::RubyZipEngine
- Inherits:
-
Object
- Object
- Officedoc::Package::Raw::RubyZipEngine
- Defined in:
- lib/officedoc/package/raw/ruby_zip_engine.rb
Instance Method Summary collapse
- #entries ⇒ Object
- #entry(name) ⇒ Object
- #entry_read_stream(name, &block) ⇒ Object
-
#initialize(stream) ⇒ RubyZipEngine
constructor
A new instance of RubyZipEngine.
Constructor Details
#initialize(stream) ⇒ RubyZipEngine
Returns a new instance of RubyZipEngine.
8 9 10 11 |
# File 'lib/officedoc/package/raw/ruby_zip_engine.rb', line 8 def initialize(stream) @f = ::Zip::File.new(stream, true, true) @f.read_from_stream(stream) end |
Instance Method Details
#entries ⇒ Object
13 14 15 |
# File 'lib/officedoc/package/raw/ruby_zip_engine.rb', line 13 def entries @entries ||= get_entries end |
#entry(name) ⇒ Object
16 17 18 19 |
# File 'lib/officedoc/package/raw/ruby_zip_engine.rb', line 16 def entry(name) @entries_by_name ||= {} @entries_by_name.fetch(name) { get_entry(name) } end |
#entry_read_stream(name, &block) ⇒ Object
20 21 22 |
# File 'lib/officedoc/package/raw/ruby_zip_engine.rb', line 20 def entry_read_stream(name,&block) entry(name).get_input_stream(&block) end |