class EPUB::Publication::Package

Constants

CONTENT_MODELS
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

inspect() click to toggle source
# File lib/epub/publication/package.rb, line 46
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 55
def inspect_models
  CONTENT_MODELS.map {|name|
    model = __send__(name)
    representation = model.nil? ? model.inspect : model.inspect_simply
    "@#{name}=#{representation}"
  }.join(' ')
end
unique_identifier() click to toggle source
# File lib/epub/publication/package.rb, line 42
def unique_identifier
  @metadata.unique_identifier
end