Class: EPUB::OCF::PhysicalContainer::Zipruby
- Inherits:
-
EPUB::OCF::PhysicalContainer
- Object
- EPUB::OCF::PhysicalContainer
- EPUB::OCF::PhysicalContainer::Zipruby
- Defined in:
- lib/epub/ocf/physical_container/zipruby.rb
Instance Method Summary collapse
Methods inherited from EPUB::OCF::PhysicalContainer
adapter, adapter=, #initialize, open, read
Constructor Details
This class inherits a constructor from EPUB::OCF::PhysicalContainer
Instance Method Details
#open ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/epub/ocf/physical_container/zipruby.rb', line 7 def open Zip::Archive.open @container_path do |archive| begin @archive = archive yield self ensure @archive = nil end end end |
#read(path_name) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/epub/ocf/physical_container/zipruby.rb', line 18 def read(path_name) if @archive @archive.fopen(path_name) {|entry| entry.read} else open {|container| container.read(path_name)} end end |