Class: Udb::ProcCertDesign
- Inherits:
-
PortfolioDesign
- Object
- PortfolioDesign
- Udb::ProcCertDesign
- Defined in:
- lib/udb/proc_cert_design.rb
Instance Attribute Summary collapse
-
#proc_cert_class ⇒ ProcCertClass
readonly
The processor certificate class object from the architecture database.
-
#proc_cert_model ⇒ ProcCertModel
readonly
The processor certificate model object from the architecture database.
Instance Method Summary collapse
-
#erb_env(*extra_inputs) ⇒ Hash<String, Object>
Add certificate-specific objects to the parent hash.
-
#include_erb(template_name, extra_inputs = {}) ⇒ String
Include a partial ERB template into a full ERB template.
-
#initialize(name, cfg_arch, portfolio_design_type, proc_cert_model, proc_cert_class) ⇒ ProcCertDesign
constructor
A new instance of ProcCertDesign.
-
#inspect ⇒ String
Returns a string representation of the object, suitable for debugging.
Constructor Details
#initialize(name, cfg_arch, portfolio_design_type, proc_cert_model, proc_cert_class) ⇒ ProcCertDesign
Returns a new instance of ProcCertDesign.
25 26 27 28 29 30 31 |
# File 'lib/udb/proc_cert_design.rb', line 25 def initialize(name, cfg_arch, portfolio_design_type, proc_cert_model, proc_cert_class) raise ArgumentError, "proc_cert_model must be a ProcCertModel" unless proc_cert_model.is_a?(ProcCertModel) raise ArgumentError, "proc_cert_class must be a ProcCertClass" unless proc_cert_class.is_a?(ProcCertClass) @proc_cert_model = proc_cert_model @proc_cert_class = proc_cert_class super(name, cfg_arch, portfolio_design_type, [proc_cert_model], proc_cert_class) end |
Instance Attribute Details
#proc_cert_class ⇒ ProcCertClass (readonly)
Returns The processor certificate class object from the architecture database.
18 19 20 |
# File 'lib/udb/proc_cert_design.rb', line 18 def proc_cert_class @proc_cert_class end |
#proc_cert_model ⇒ ProcCertModel (readonly)
Returns The processor certificate model object from the architecture database.
15 16 17 |
# File 'lib/udb/proc_cert_design.rb', line 15 def proc_cert_model @proc_cert_model end |
Instance Method Details
#erb_env(*extra_inputs) ⇒ Hash<String, Object>
Add certificate-specific objects to the parent hash.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/udb/proc_cert_design.rb', line 40 def erb_env(*extra_inputs) raise ArgumentError, "extra_inputs must be an Array but is a #{extra_inputs.class}" unless extra_inputs.is_a?(Array) h = super # Call parent method with whatever args I got h[:proc_cert_design] = self h[:proc_cert_model] = proc_cert_model h[:proc_cert_class] = proc_cert_class h end |
#include_erb(template_name, extra_inputs = {}) ⇒ String
Include a partial ERB template into a full ERB template. Can be either in the portfolio or proc_cert backends (but not both).
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/udb/proc_cert_design.rb', line 59 def include_erb(template_name, extra_inputs = {}) proc_cert_template_pname = "proc_cert/templates/#{template_name}" proc_cert_template_path = Pathname.new($root / "backends" / proc_cert_template_pname) portfolio_template_pname = "portfolio/templates/#{template_name}" portfolio_template_path = Pathname.new($root / "backends" / portfolio_template_pname) if proc_cert_template_path.exist? && portfolio_template_path.exist? raise "Both #{proc_cert_template_pname} and #{portfolio_template_pname} exist. Need unique names." elsif proc_cert_template_path.exist? partial(proc_cert_template_pname, erb_env(extra_inputs)) elsif portfolio_template_path.exist? partial(portfolio_template_pname, erb_env(extra_inputs)) else raise "Can't find file #{template_name} in either #{proc_cert_template_pname} or #{portfolio_template_pname}." end end |
#inspect ⇒ String
Returns a string representation of the object, suitable for debugging.
35 |
# File 'lib/udb/proc_cert_design.rb', line 35 def inspect = "ProcCertDesign##{name}" |