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.
71 72 73 74 |
# File 'lib/udb/obj/manual.rb', line 71 def initialize(data, version) @data = data @version = version end |
Instance Attribute Details
#version ⇒ ManualVersion (readonly)
Returns The version this volume belongs to.
67 68 69 |
# File 'lib/udb/obj/manual.rb', line 67 def version @version end |
Instance Method Details
#cfg_arch ⇒ Object
69 |
# File 'lib/udb/obj/manual.rb', line 69 def cfg_arch = version.cfg_arch |
#chapter(name) ⇒ Object
89 |
# File 'lib/udb/obj/manual.rb', line 89 def chapter(name) = chapters.find { |c| c.name == name } |
#chapters ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/udb/obj/manual.rb', line 76 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.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/udb/obj/manual.rb', line 94 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? warn "Extension '#{ext_hsh['name']}' is not in the database" next end ext_ver = ExtensionVersion.new(ext_hsh["name"], ext_hsh["version"], cfg_arch) unless ext_obj.versions.any? { |known_ver| known_ver == ext_ver } 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
118 119 120 121 |
# File 'lib/udb/obj/manual.rb', line 118 def repo_path=(path) @repo_path = path chapters.each { |c| c.repo_path = path } end |
#title ⇒ Object
91 |
# File 'lib/udb/obj/manual.rb', line 91 def title = @data["title"] |