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
Defined Under Namespace
Classes: Bindings, Guide, Manifest, Metadata, 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#' }
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
-
#initialize ⇒ Package
constructor
A new instance of Package.
- #inspect ⇒ Object
- #inspect_models ⇒ Object
- #unique_identifier ⇒ Object
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
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
#inspect ⇒ Object
46 47 48 49 50 51 52 53 |
# 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 ⇒ Object
55 56 57 58 59 60 61 |
# 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 ⇒ Object
42 43 44 |
# File 'lib/epub/publication/package.rb', line 42 def unique_identifier @metadata.unique_identifier end |