Class: EPUB::Publication::Package
- Inherits:
-
Object
- Object
- EPUB::Publication::Package
- Includes:
- Inspector
- Defined in:
- lib/epub/publication/package.rb,
lib/epub/publication/package/guide.rb,
lib/epub/publication/package/spine.rb,
lib/epub/publication/package/bindings.rb,
lib/epub/publication/package/manifest.rb,
lib/epub/publication/package/metadata.rb more...
Defined Under Namespace
Classes: Bindings, Guide, Manifest, Spine
Constant Summary collapse
- CONTENT_MODELS =
[:metadata, :manifest, :spine, :guide, :bindings]
- RESERVED_VOCABULARY_PREFIXES =
{ '' => 'http://idpf.org/epub/vocab/package/#', 'dcterms' => 'http://purl.org/dc/terms/', 'marc' => 'http://id.loc.gov/vocabulary/', 'media' => 'http://www.idpf.org/epub/vocab/overlays/#', 'onix' => 'http://www.editeur.org/ONIX/book/codelists/current.html#', 'xsd' => 'http://www.w3.org/2001/XMLSchema#' }
- Metadata =
EPUB::Metadata
Constants included from Inspector
Inspector::INSTANCE_VARIABLES_OPTION, Inspector::SIMPLE_TEMPLATE
Instance Attribute Summary collapse
-
#book ⇒ Object
Returns the value of attribute book.
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#id ⇒ Object
Returns the value of attribute id.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#version ⇒ Object
Returns the value of attribute version.
-
#xml_lang ⇒ Object
(also: #lang)
Returns the value of attribute xml_lang.
Class Method Summary collapse
Instance Method Summary collapse
-
#full_path ⇒ Addressable::URI
Full path in EPUB archive.
-
#initialize ⇒ Package
constructor
A new instance of Package.
- #inspect ⇒ Object
- #inspect_models ⇒ Object
-
#rootfile ⇒ OCF::Container::Rootfile
Corresponding Rootfile.
-
#unique_identifier ⇒ EPUB::Metadata::Identifier
Unique Identifier.
Methods included from Inspector
#inspect_instance_variables, #inspect_object_id, #inspect_simply
Constructor Details
#initialize ⇒ Package
Returns a new instance of Package.
38 39 40 |
# File 'lib/epub/publication/package.rb', line 38 def initialize @prefix = {} end |
Instance Attribute Details
#book ⇒ Object
Returns the value of attribute book.
28 29 30 |
# File 'lib/epub/publication/package.rb', line 28 def book @book end |
#dir ⇒ Object
Returns the value of attribute dir.
28 29 30 |
# File 'lib/epub/publication/package.rb', line 28 def dir @dir end |
#id ⇒ Object
Returns the value of attribute id.
28 29 30 |
# File 'lib/epub/publication/package.rb', line 28 def id @id end |
#prefix ⇒ Object
Returns the value of attribute prefix.
28 29 30 |
# File 'lib/epub/publication/package.rb', line 28 def prefix @prefix end |
#version ⇒ Object
Returns the value of attribute version.
28 29 30 |
# File 'lib/epub/publication/package.rb', line 28 def version @version end |
#xml_lang ⇒ Object Also known as: lang
Returns the value of attribute xml_lang.
28 29 30 |
# File 'lib/epub/publication/package.rb', line 28 def xml_lang @xml_lang end |
Class Method Details
.define_content_model(model_name) ⇒ Object
[View source]
18 19 20 21 22 23 24 25 |
# 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 |
Instance Method Details
#full_path ⇒ Addressable::URI
Full path in EPUB archive
55 56 57 |
# File 'lib/epub/publication/package.rb', line 55 def full_path rootfile.full_path if rootfile end |
#inspect ⇒ Object
[View source]
59 60 61 62 63 64 65 66 |
# 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 ⇒ Object
[View source]
68 69 70 71 72 73 74 |
# 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 ⇒ OCF::Container::Rootfile
Corresponding Rootfile
49 50 51 |
# File 'lib/epub/publication/package.rb', line 49 def rootfile @book.ocf.container.rootfiles.find {|rf| rf.package == self} end |
#unique_identifier ⇒ EPUB::Metadata::Identifier
Returns Unique Identifier.
43 44 45 |
# File 'lib/epub/publication/package.rb', line 43 def unique_identifier @metadata.unique_identifier end |