Class: CertModel::Requirement

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

Overview

Holds extra requirements not associated with extensions or their parameters.

Instance Method Summary collapse

Constructor Details

#initialize(data, arch_def) ⇒ Requirement

Returns a new instance of Requirement.



63
64
65
66
# File 'lib/arch_obj_models/certificate.rb', line 63

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

Instance Method Details

#descriptionObject



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

def description = @data["description"]

#whenObject



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

def when = @data["when"]

#when_prettyObject



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/arch_obj_models/certificate.rb', line 72

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