Class: Udb::ManualVolume
- Inherits:
-
Object
- Object
- Udb::ManualVolume
- Defined in:
- lib/udb/obj/manual.rb
Instance Attribute Summary collapse
-
#version ⇒ ManualVersion
readonly
The version this volume belongs to.
Instance Method Summary collapse
- #cfg_arch ⇒ Object
- #chapter(name) ⇒ Object
- #chapters ⇒ Object
-
#extensions ⇒ Array<ExtensionVersion>
Array of extension versions in this volume.
-
#initialize(data, version) ⇒ ManualVolume
constructor
A new instance of ManualVolume.
- #repo_path=(path) ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(data, version) ⇒ ManualVolume
Returns a new instance of ManualVolume.
72 73 74 75 |
# File 'lib/udb/obj/manual.rb', line 72 def initialize(data, version) @data = data @version = version end |
Instance Attribute Details
#version ⇒ ManualVersion (readonly)
Returns The version this volume belongs to.
68 69 70 |
# File 'lib/udb/obj/manual.rb', line 68 def version @version end |
Instance Method Details
#cfg_arch ⇒ Object
70 |
# File 'lib/udb/obj/manual.rb', line 70 def cfg_arch = version.cfg_arch |
#chapter(name) ⇒ Object
90 |
# File 'lib/udb/obj/manual.rb', line 90 def chapter(name) = chapters.find { |c| c.name == name } |
#chapters ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/udb/obj/manual.rb', line 77 def chapters return @chapters unless @chapters.nil? @chapters = [] return @chapters if @data["chapters"].nil? @data["chapters"].each do |chapter_path| @chapters << ManualChapter.new(self, chapter_path) end @chapters end |
#extensions ⇒ Array<ExtensionVersion>
Returns Array of extension versions in this volume.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/udb/obj/manual.rb', line 95 def extensions return @extensions unless @extensions.nil? @extensions = [] return @extensions if @data["extensions"].nil? @data["extensions"].each do |ext_hsh| ext_obj = cfg_arch.extension(ext_hsh["name"]) if ext_obj.nil? Udb.logger.warn "Extension '#{ext_hsh['name']}' is not in the database" next end ext_ver = cfg_arch.extension_version(ext_hsh["name"], ext_hsh["version"]) unless ext_obj.versions.any? { |known_ver| known_ver == ext_ver } Udb.logger.warn "Extension '#{ext_hsh['name']}', version '#{ext_hsh['version']}' is not defined in the database" next end @extensions << ext_ver end @extensions end |
#repo_path=(path) ⇒ Object
119 120 121 122 |
# File 'lib/udb/obj/manual.rb', line 119 def repo_path=(path) @repo_path = path chapters.each { |c| c.repo_path = path } end |
#title ⇒ Object
92 |
# File 'lib/udb/obj/manual.rb', line 92 def title = @data["title"] |