Class: ManualVolume

Inherits:
Object
  • Object
show all
Defined in:
lib/arch_obj_models/manual.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, version) ⇒ ManualVolume

Returns a new instance of ManualVolume.



64
65
66
67
# File 'lib/arch_obj_models/manual.rb', line 64

def initialize(data, version)
  @data = data
  @version = version
end

Instance Attribute Details

#versionManualVersion (readonly)

Returns The version this volume belongs to.

Returns:



59
60
61
# File 'lib/arch_obj_models/manual.rb', line 59

def version
  @version
end

Instance Method Details

#arch_defArchDef

Returns The architecture definition.

Returns:

  • (ArchDef)

    The architecture definition



62
# File 'lib/arch_obj_models/manual.rb', line 62

def arch_def = version.arch_def

#chapter(name) ⇒ Object



82
# File 'lib/arch_obj_models/manual.rb', line 82

def chapter(name) = chapters.find { |c| c.name == name }

#chaptersObject



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/arch_obj_models/manual.rb', line 69

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

#extensionsArray<ExtensionVersion>

Returns Array of extension versions in this volume.

Returns:



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/arch_obj_models/manual.rb', line 87

def extensions
  return @extensions unless @extensions.nil?

  @extensions = []
  return @extensions if @data["extensions"].nil?

  @data["extensions"].each do |ext|
    ext_obj = arch_def.extension(ext[0])
    if ext_obj.nil?
      warn "Extension '#{ext[0]}' is not in the database"
      next
    end

    unless ext_obj.versions.any? { |v| v.version == ext[1] }
      warn "Extension '#{ext[0]}', version '#{ext[1]}' is not defined in the database"
      next
    end

    @extensions << ExtensionVersion.new(ext[0], ext[1], arch_def)
  end
  @extensions
end

#titleObject



84
# File 'lib/arch_obj_models/manual.rb', line 84

def title = @data["title"]