Class: Udb::ProcCertModel::RequirementGroup
- Inherits:
-
Object
- Object
- Udb::ProcCertModel::RequirementGroup
- Defined in:
- lib/udb/obj/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
- #description ⇒ Object
-
#initialize(data, arch) ⇒ RequirementGroup
constructor
A new instance of RequirementGroup.
- #name ⇒ Object
-
#requirements ⇒ Array<Requirement>
The list of requirements in this group.
- #when ⇒ Object
- #when_pretty ⇒ Object
Constructor Details
#initialize(data, arch) ⇒ RequirementGroup
Returns a new instance of RequirementGroup.
105 106 107 108 109 110 111 |
# File 'lib/udb/obj/certificate.rb', line 105 def initialize(data, arch) raise ArgumentError, "data is a #{data.class} class containing '#{data}' but needs to be a Hash" unless data.is_a?(Hash) raise ArgumentError, "arch is a #{arch.class} class but needs to be an Architecture class" unless arch.is_a?(Architecture) @data = data @arch = arch end |
Instance Method Details
#description ⇒ Object
114 |
# File 'lib/udb/obj/certificate.rb', line 114 def description = @data["description"] |
#name ⇒ Object
113 |
# File 'lib/udb/obj/certificate.rb', line 113 def name = @data["name"] |
#requirements ⇒ Array<Requirement>
Returns The list of requirements in this group.
133 134 135 136 137 138 139 140 141 |
# File 'lib/udb/obj/certificate.rb', line 133 def requirements return @requirements unless @requirements.nil? @requirements = [] @data["requirements"].each do |req| @requirements << Requirement.new(req, @arch) end @requirements end |
#when ⇒ Object
115 |
# File 'lib/udb/obj/certificate.rb', line 115 def when = @data["when"] |
#when_pretty ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/udb/obj/certificate.rb', line 117 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 "Type #{key} not implemented" end end.flatten.join(" and ") end |