Class: DecisionAgent::Dmn::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/decision_agent/dmn/model.rb

Overview

Decision table rule (row)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, description: nil) ⇒ Rule



169
170
171
172
173
174
# File 'lib/decision_agent/dmn/model.rb', line 169

def initialize(id:, description: nil)
  @id = id.to_s
  @description = description&.to_s
  @input_entries = []
  @output_entries = []
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



167
168
169
# File 'lib/decision_agent/dmn/model.rb', line 167

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



167
168
169
# File 'lib/decision_agent/dmn/model.rb', line 167

def id
  @id
end

#input_entriesObject (readonly)

Returns the value of attribute input_entries.



167
168
169
# File 'lib/decision_agent/dmn/model.rb', line 167

def input_entries
  @input_entries
end

#output_entriesObject (readonly)

Returns the value of attribute output_entries.



167
168
169
# File 'lib/decision_agent/dmn/model.rb', line 167

def output_entries
  @output_entries
end

Instance Method Details

#add_input_entry(entry) ⇒ Object



176
177
178
# File 'lib/decision_agent/dmn/model.rb', line 176

def add_input_entry(entry)
  @input_entries << entry.to_s
end

#add_output_entry(entry) ⇒ Object



180
181
182
# File 'lib/decision_agent/dmn/model.rb', line 180

def add_output_entry(entry)
  @output_entries << entry
end

#freezeObject



184
185
186
187
188
189
190
191
192
# File 'lib/decision_agent/dmn/model.rb', line 184

def freeze
  @id.freeze
  @description.freeze
  @input_entries.each(&:freeze)
  @input_entries.freeze
  @output_entries.map { |e| e.freeze if e.respond_to?(:freeze) }
  @output_entries.freeze
  super
end