Class: Roby::ExecutionEngine::PollBlockDefinition Private
- Defined in:
- lib/roby/execution_engine.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Internal structure used to store a poll block definition provided to #every or #add_propagation_handler
Constant Summary collapse
- ON_ERROR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[:raise, :ignore, :disable]
Instance Attribute Summary collapse
- #description ⇒ Object readonly private
- #handler ⇒ Object readonly private
- #on_error ⇒ Object readonly private
Instance Method Summary collapse
- #call(engine, *args) ⇒ Object private
- #id ⇒ Object private
-
#initialize(description, handler, on_error: :raise, late: false, once: false) ⇒ PollBlockDefinition
constructor
private
A new instance of PollBlockDefinition.
- #to_s ⇒ Object private
Constructor Details
#initialize(description, handler, on_error: :raise, late: false, once: false) ⇒ PollBlockDefinition
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PollBlockDefinition.
221 222 223 224 225 226 227 228 229 |
# File 'lib/roby/execution_engine.rb', line 221 def initialize(description, handler, on_error: :raise, late: false, once: false) if !PollBlockDefinition::ON_ERROR.include?(on_error.to_sym) raise ArgumentError, "invalid value '#{on_error} for the :on_error option. Accepted values are #{ON_ERROR.map(&:to_s).join(", ")}" end @description, @handler, @on_error, @late, @once = description, handler, on_error, late, once @disabled = false end |
Instance Attribute Details
#description ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
212 213 214 |
# File 'lib/roby/execution_engine.rb', line 212 def description @description end |
#handler ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
213 214 215 |
# File 'lib/roby/execution_engine.rb', line 213 def handler @handler end |
#on_error ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
214 215 216 |
# File 'lib/roby/execution_engine.rb', line 214 def on_error @on_error end |
Instance Method Details
#call(engine, *args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/roby/execution_engine.rb', line 233 def call(engine, *args) handler.call(*args) true rescue Exception => e if on_error == :raise engine.add_framework_error(e, description) return false elsif on_error == :disable engine.warn "propagation handler #{description} disabled because of the following error" Roby.log_exception_with_backtrace(e, engine, :warn) return false elsif on_error == :ignore engine.warn "ignored error from propagation handler #{description}" Roby.log_exception_with_backtrace(e, engine, :warn) return true end end |
#id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
219 |
# File 'lib/roby/execution_engine.rb', line 219 def id; handler.object_id end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
231 |
# File 'lib/roby/execution_engine.rb', line 231 def to_s; "#<PollBlockDefinition: #{description} #{handler} on_error:#{on_error}>" end |