Class: DecisionAgent::Dmn::Model
- Inherits:
-
Object
- Object
- DecisionAgent::Dmn::Model
- Defined in:
- lib/decision_agent/dmn/model.rb
Overview
Root DMN model containing all decisions
Instance Attribute Summary collapse
-
#decisions ⇒ Object
readonly
Returns the value of attribute decisions.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
- #add_decision(decision) ⇒ Object
- #find_decision(decision_id) ⇒ Object
- #freeze ⇒ Object
-
#initialize(id:, name:, namespace: "http://decision_agent.local") ⇒ Model
constructor
A new instance of Model.
Constructor Details
#initialize(id:, name:, namespace: "http://decision_agent.local") ⇒ Model
Returns a new instance of Model.
11 12 13 14 15 16 |
# File 'lib/decision_agent/dmn/model.rb', line 11 def initialize(id:, name:, namespace: "http://decision_agent.local") @id = id.to_s @name = name.to_s @namespace = namespace.to_s @decisions = [] end |
Instance Attribute Details
#decisions ⇒ Object (readonly)
Returns the value of attribute decisions.
9 10 11 |
# File 'lib/decision_agent/dmn/model.rb', line 9 def decisions @decisions end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/decision_agent/dmn/model.rb', line 9 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/decision_agent/dmn/model.rb', line 9 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
9 10 11 |
# File 'lib/decision_agent/dmn/model.rb', line 9 def namespace @namespace end |
Instance Method Details
#add_decision(decision) ⇒ Object
18 19 20 21 22 |
# File 'lib/decision_agent/dmn/model.rb', line 18 def add_decision(decision) raise TypeError, "Expected Decision, got #{decision.class}" unless decision.is_a?(Decision) @decisions << decision end |
#find_decision(decision_id) ⇒ Object
24 25 26 |
# File 'lib/decision_agent/dmn/model.rb', line 24 def find_decision(decision_id) @decisions.find { |d| d.id == decision_id.to_s } end |
#freeze ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/decision_agent/dmn/model.rb', line 28 def freeze @id.freeze @name.freeze @namespace.freeze @decisions.each(&:freeze) @decisions.freeze super end |