Class: EPUB::Publication::Package::Manifest
Defined Under Namespace
Classes: Item
Constant Summary
Inspector::PublicationModel::TEMPLATE
Instance Attribute Summary collapse
Instance Method Summary
collapse
included, #inspect
Constructor Details
Returns a new instance of Manifest.
16
17
18
|
# File 'lib/epub/publication/package/manifest.rb', line 16
def initialize
@items = {}
end
|
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
13
14
15
|
# File 'lib/epub/publication/package/manifest.rb', line 13
def id
@id
end
|
#package ⇒ Object
Returns the value of attribute package.
13
14
15
|
# File 'lib/epub/publication/package/manifest.rb', line 13
def package
@package
end
|
Instance Method Details
#<<(item) ⇒ Object
21
22
23
24
25
|
# File 'lib/epub/publication/package/manifest.rb', line 21
def <<(item)
item.manifest = self
@items[item.id] = item
self
end
|
#[](item_id) ⇒ Object
63
64
65
|
# File 'lib/epub/publication/package/manifest.rb', line 63
def [](item_id)
@items[item_id]
end
|
#cover_image ⇒ Object
45
46
47
|
# File 'lib/epub/publication/package/manifest.rb', line 45
def cover_image
items.select(&:cover_image?).first
end
|
#each_item ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/epub/publication/package/manifest.rb', line 49
def each_item
if block_given?
@items.each_value do |item|
yield item
end
else
@items.each_value
end
end
|
#each_nav ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'lib/epub/publication/package/manifest.rb', line 27
def each_nav
if block_given?
each_item do |item|
yield item if item.nav?
end
else
each_item.lazy.select(&:nav?)
end
end
|
#items ⇒ Object
59
60
61
|
# File 'lib/epub/publication/package/manifest.rb', line 59
def items
@items.values
end
|
#nav ⇒ Object
41
42
43
|
# File 'lib/epub/publication/package/manifest.rb', line 41
def nav
navs.first
end
|
#navs ⇒ Object
37
38
39
|
# File 'lib/epub/publication/package/manifest.rb', line 37
def navs
items.select(&:nav?)
end
|