Sha256: 455f8cfc8827a21778da82044e836de1ca2181ad3b6ecb34b5c47fdd211c4aec

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

require 'zipruby'

module EPUB
  class OCF
    class PhysicalContainer
      class Zipruby < self
        def open
          Zip::Archive.open @container_path do |archive|
            begin
              @archive = archive
              yield self
            ensure
              @archive = nil
            end
          end
        end

        def read(path_name)
          if @archive
            @archive.fopen(path_name) {|entry| entry.read}
          else
            open {|container| container.read(path_name)}
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
epub-parser-0.2.5 lib/epub/ocf/physical_container/zipruby.rb
epub-parser-0.2.4 lib/epub/ocf/physical_container/zipruby.rb