class EPUB::Publication::Package

Constants

CONTENT_MODELS
Metadata
RESERVED_VOCABULARY_PREFIXES

Attributes

book[RW]
dir[RW]
id[RW]
lang[RW]
lang=[RW]
prefix[RW]
version[RW]
xml_lang[RW]

Public Class Methods

define_content_model(model_name) click to toggle source
# File lib/epub/publication/package.rb, line 18
def define_content_model(model_name)
  define_method "#{model_name}=" do |model|
    current_model = __send__(model_name)
    current_model.package = nil if current_model
    model.package = self
    instance_variable_set "@#{model_name}", model
  end
end
new() click to toggle source
# File lib/epub/publication/package.rb, line 38
def initialize
  @prefix = {}
end

Public Instance Methods

full_path() click to toggle source

Full path in EPUB archive @return [Addressable::URI]

# File lib/epub/publication/package.rb, line 55
def full_path
  rootfile.full_path if rootfile
end
inspect() click to toggle source
# File lib/epub/publication/package.rb, line 59
def inspect
  "#<%{class}:%{object_id} %{attributes} %{models}>" % {
    :class      => self.class,
    :object_id  => inspect_object_id,
    :attributes => inspect_instance_variables(exclude: CONTENT_MODELS.map {|model| :"@#{model}"}),
    :models     => inspect_models
  }
end
inspect_models() click to toggle source
# File lib/epub/publication/package.rb, line 68
def inspect_models
  CONTENT_MODELS.map {|name|
    model = __send__(name)
    representation = model.nil? ? model.inspect : model.inspect_simply
    "@#{name}=#{representation}"
  }.join(' ')
end
rootfile() click to toggle source

Corresponding {Rootfile} @return [OCF::Container::Rootfile]

# File lib/epub/publication/package.rb, line 49
def rootfile
  @book.ocf.container.rootfiles.find {|rf| rf.package == self}
end
unique_identifier() click to toggle source

@return [EPUB::Metadata::Identifier] Unique Identifier

# File lib/epub/publication/package.rb, line 43
def unique_identifier
  @metadata.unique_identifier
end