Class: CertModel::RequirementGroup

Inherits:
ArchDefObject show all
Defined in:
lib/arch_obj_models/certificate.rb

Overview

Holds a group of Requirement objects to provide a one-level group. Can’t nest RequirementGroup objects to make multi-level group.

Instance Method Summary collapse

Constructor Details

#initialize(data, arch_def) ⇒ RequirementGroup

Returns a new instance of RequirementGroup.



95
96
97
98
# File 'lib/arch_obj_models/certificate.rb', line 95

def initialize(data, arch_def)
  super(data)
  @arch_def = arch_def
end

Instance Method Details

#descriptionObject



100
# File 'lib/arch_obj_models/certificate.rb', line 100

def description = @data["description"]

#requirementsObject



119
120
121
122
123
124
125
126
127
# File 'lib/arch_obj_models/certificate.rb', line 119

def requirements
  return @requirements unless @requirements.nil?

  @requirements = []
  @data["requirements"].each do |req|
    @requirements << Requirement.new(req, @arch_def)
  end
  @requirements
end

#whenObject



102
# File 'lib/arch_obj_models/certificate.rb', line 102

def when = @data["when"]

#when_prettyObject



104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/arch_obj_models/certificate.rb', line 104

def when_pretty
  @data["when"].keys.map do |key|
    case key
    when "xlen"
      "XLEN == #{@data["when"]["xlen"]}"
    when "param"
      @data["when"]["param"].map do |param_name, param_value|
        "Parameter #{param_name} == #{param_value}"
      end
    else
      raise "TODO: when type #{key} not implemented"
    end
  end.flatten.join(" and ")
end