Class: StatesLanguageMachine::States::Succeed
- Inherits:
-
Base
- Object
- StatesLanguageMachine::State
- Base
- StatesLanguageMachine::States::Succeed
- Defined in:
- lib/ruby_slm/states/succeed.rb
Instance Attribute Summary collapse
-
#input_path ⇒ String?
readonly
The input path.
-
#output_path ⇒ String?
readonly
The output path.
Attributes inherited from Base
Attributes inherited from StatesLanguageMachine::State
#end_state, #name, #next_state, #type
Instance Method Summary collapse
-
#execute(execution, input) ⇒ Hash
The output data from the state.
-
#initialize(name, definition) ⇒ Succeed
constructor
A new instance of Succeed.
-
#validate! ⇒ Object
Validate the succeed state definition.
Methods inherited from StatesLanguageMachine::State
Constructor Details
#initialize(name, definition) ⇒ Succeed
Returns a new instance of Succeed.
13 14 15 16 17 |
# File 'lib/ruby_slm/states/succeed.rb', line 13 def initialize(name, definition) super @input_path = definition["InputPath"] @output_path = definition["OutputPath"] end |
Instance Attribute Details
#input_path ⇒ String? (readonly)
Returns the input path.
7 8 9 |
# File 'lib/ruby_slm/states/succeed.rb', line 7 def input_path @input_path end |
#output_path ⇒ String? (readonly)
Returns the output path.
9 10 11 |
# File 'lib/ruby_slm/states/succeed.rb', line 9 def output_path @output_path end |
Instance Method Details
#execute(execution, input) ⇒ Hash
Returns the output data from the state.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ruby_slm/states/succeed.rb', line 22 def execute(execution, input) execution.logger&.info("Executing succeed state: #{@name}") processed_input = apply_input_path(input, @input_path) final_output = apply_output_path(processed_input, @output_path) execution.status = :succeeded process_result(execution, final_output) final_output end |
#validate! ⇒ Object
Validate the succeed state definition
34 35 36 |
# File 'lib/ruby_slm/states/succeed.rb', line 34 def validate! # Succeed states don't need Next or End end |