Class: Officedoc::Package::Raw::RubyZipEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/officedoc/package/raw/ruby_zip_engine.rb

Instance Method Summary collapse

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

#entriesObject



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