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.
%i[raise ignore disable].freeze
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
- #dispose ⇒ Object private
- #disposed? ⇒ Boolean 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.
222 223 224 225 226 227 228 229 230 231 |
# File 'lib/roby/execution_engine.rb', line 222 def initialize(description, handler, on_error: :raise, late: false, once: false) unless 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 @disposed = 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.
212 213 214 |
# File 'lib/roby/execution_engine.rb', line 212 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.
212 213 214 |
# File 'lib/roby/execution_engine.rb', line 212 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.
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/roby/execution_engine.rb', line 246 def call(engine, *args) handler.call(*args) true rescue Exception => e case on_error when :raise engine.add_framework_error(e, description) false when :disable engine.warn "propagation handler #{description} disabled "\ "because of the following error" Roby.log_exception_with_backtrace(e, engine, :warn) false when :ignore engine.warn "ignored error from propagation handler #{description}" Roby.log_exception_with_backtrace(e, engine, :warn) true end end |
#dispose ⇒ 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.
241 242 243 244 |
# File 'lib/roby/execution_engine.rb', line 241 def dispose @disabled = true @disposed = true end |
#disposed? ⇒ Boolean
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.
237 238 239 |
# File 'lib/roby/execution_engine.rb', line 237 def disposed? @disposed 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.
218 219 220 |
# File 'lib/roby/execution_engine.rb', line 218 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.
233 234 235 |
# File 'lib/roby/execution_engine.rb', line 233 def to_s "#<PollBlockDefinition: #{description} #{handler} on_error:#{on_error}>" end |