Class: FlowNodes::Node
Overview
A node with built-in retry logic.
Instance Attribute Summary collapse
-
#current_retry ⇒ Object
readonly
Returns the value of attribute current_retry.
-
#max_retries ⇒ Object
readonly
Returns the value of attribute max_retries.
-
#wait ⇒ Object
readonly
Returns the value of attribute wait.
Attributes inherited from BaseNode
Instance Method Summary collapse
-
#_run(s) ⇒ Object
Public method to execute the node’s logic with retries.
-
#initialize(max_retries: 1, wait: 0) ⇒ Node
constructor
A new instance of Node.
Methods inherited from BaseNode
#-, #>>, #exec, #initialize_copy, #nxt, #run, #set_params
Constructor Details
#initialize(max_retries: 1, wait: 0) ⇒ Node
Returns a new instance of Node.
8 9 10 11 12 13 |
# File 'lib/flow_nodes/node.rb', line 8 def initialize(max_retries: 1, wait: 0) super() @max_retries = max_retries @wait = wait @current_retry = 0 end |
Instance Attribute Details
#current_retry ⇒ Object (readonly)
Returns the value of attribute current_retry.
6 7 8 |
# File 'lib/flow_nodes/node.rb', line 6 def current_retry @current_retry end |
#max_retries ⇒ Object (readonly)
Returns the value of attribute max_retries.
6 7 8 |
# File 'lib/flow_nodes/node.rb', line 6 def max_retries @max_retries end |
#wait ⇒ Object (readonly)
Returns the value of attribute wait.
6 7 8 |
# File 'lib/flow_nodes/node.rb', line 6 def wait @wait end |
Instance Method Details
#_run(s) ⇒ Object
Public method to execute the node’s logic with retries. This is the entry point for a flow to run a node.
17 18 19 20 21 22 23 |
# File 'lib/flow_nodes/node.rb', line 17 def _run(s) prepared_params = prep(s) actual_params = prepared_params || @params execution_result = _exec(actual_params) post(s, actual_params, execution_result) execution_result end |