Class: Validator::AutoNode
- Inherits:
-
Object
- Object
- Validator::AutoNode
- Defined in:
- spec/support/auto_node.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#task ⇒ Object
readonly
Returns the value of attribute task.
Instance Method Summary collapse
-
#initialize ⇒ AutoNode
constructor
A new instance of AutoNode.
-
#running? ⇒ Boolean
Check if the auto node is running.
-
#start ⇒ Object
Start the auto node inside the async reactor This method should be called from within the reactor context.
-
#stop ⇒ Object
Stop the auto node.
Constructor Details
#initialize ⇒ AutoNode
Returns a new instance of AutoNode.
13 14 15 16 |
# File 'spec/support/auto_node.rb', line 13 def initialize @node = nil @task = nil end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
11 12 13 |
# File 'spec/support/auto_node.rb', line 11 def node @node end |
#task ⇒ Object (readonly)
Returns the value of attribute task.
11 12 13 |
# File 'spec/support/auto_node.rb', line 11 def task @task end |
Instance Method Details
#running? ⇒ Boolean
Check if the auto node is running
54 55 56 |
# File 'spec/support/auto_node.rb', line 54 def running? @node && @task end |
#start ⇒ Object
Start the auto node inside the async reactor This method should be called from within the reactor context
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'spec/support/auto_node.rb', line 20 def start return if @node Validator.log "Starting auto #{node_type}", level: :info @node = build_node # Run the node in a separate async task within the same reactor @task = Async do |task| task.annotate "auto_#{node_type}" begin @node.start # This will keep running until stopped rescue StandardError => e Validator.log "Auto #{node_type} error: #{e.class}: #{e.}", level: :error raise end end end |