Class: StatesLanguageMachine::States::Pass
- Inherits:
-
Base
- Object
- StatesLanguageMachine::State
- Base
- StatesLanguageMachine::States::Pass
- Defined in:
- lib/ruby_slm/states/pass.rb
Instance Attribute Summary collapse
-
#input_path ⇒ String?
readonly
The input path.
-
#output_path ⇒ String?
readonly
The output path.
-
#result ⇒ Object?
readonly
The result to pass through.
-
#result_path ⇒ String?
readonly
The result 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) ⇒ Pass
constructor
A new instance of Pass.
Methods inherited from Base
Methods inherited from StatesLanguageMachine::State
Constructor Details
#initialize(name, definition) ⇒ Pass
Returns a new instance of Pass.
17 18 19 20 21 22 23 |
# File 'lib/ruby_slm/states/pass.rb', line 17 def initialize(name, definition) super @result = definition["Result"] @result_path = definition["ResultPath"] @input_path = definition["InputPath"] @output_path = definition["OutputPath"] end |
Instance Attribute Details
#input_path ⇒ String? (readonly)
Returns the input path.
11 12 13 |
# File 'lib/ruby_slm/states/pass.rb', line 11 def input_path @input_path end |
#output_path ⇒ String? (readonly)
Returns the output path.
13 14 15 |
# File 'lib/ruby_slm/states/pass.rb', line 13 def output_path @output_path end |
#result ⇒ Object? (readonly)
Returns the result to pass through.
7 8 9 |
# File 'lib/ruby_slm/states/pass.rb', line 7 def result @result end |
#result_path ⇒ String? (readonly)
Returns the result path.
9 10 11 |
# File 'lib/ruby_slm/states/pass.rb', line 9 def result_path @result_path end |
Instance Method Details
#execute(execution, input) ⇒ Hash
Returns the output data from the state.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ruby_slm/states/pass.rb', line 28 def execute(execution, input) execution.logger&.info("Executing pass state: #{@name}") processed_input = apply_input_path(input, @input_path) result = @result || processed_input output = apply_result_path(input, result, @result_path) final_output = apply_output_path(output, @output_path) process_result(execution, final_output) final_output end |