class EPUB::OCF::PhysicalContainer

Public Class Methods

adapter() click to toggle source
# File lib/epub/ocf/physical_container.rb, line 30
def adapter
  raise NoMethodError, "undefined method `#{__method__}' for #{self}" unless self == PhysicalContainer
  @adapter
end
adapter=(adapter) click to toggle source
# File lib/epub/ocf/physical_container.rb, line 35
def adapter=(adapter)
  raise NoMethodError, "undefined method `#{__method__}' for #{self}" unless self == PhysicalContainer
  @adapter = find_adapter(adapter)
end
find_adapter(adapter) click to toggle source
# File lib/epub/ocf/physical_container.rb, line 22
def find_adapter(adapter)
  return adapter if adapter.instance_of? Class
  if adapter == :Zipruby && ! const_defined?(adapter)
    require 'epub/ocf/physical_container/zipruby'
  end
  const_get adapter
end
new(container_path) click to toggle source
# File lib/epub/ocf/physical_container.rb, line 59
def initialize(container_path)
  @container_path = container_path
  @monitor = Monitor.new
end
open(container_path) { |container| ... } click to toggle source
# File lib/epub/ocf/physical_container.rb, line 40
def open(container_path)
  _adapter.new(container_path).open do |container|
    yield container
  end
end
read(container_path, path_name) click to toggle source
# File lib/epub/ocf/physical_container.rb, line 46
def read(container_path, path_name)
  open(container_path) {|container|
    container.read(path_name.to_s)
  }
end

Private Class Methods

_adapter() click to toggle source
# File lib/epub/ocf/physical_container.rb, line 54
def _adapter
  (self == PhysicalContainer) ? @adapter : self
end