Class: Axn::Core::Flow::Handlers::BaseDescriptor
- Inherits:
-
Object
- Object
- Axn::Core::Flow::Handlers::BaseDescriptor
- Defined in:
- lib/axn/core/flow/handlers/base_descriptor.rb
Direct Known Subclasses
Descriptors::CallbackDescriptor, Descriptors::MessageDescriptor
Instance Attribute Summary collapse
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(matcher: nil, handler: nil) ⇒ BaseDescriptor
constructor
A new instance of BaseDescriptor.
- #matches?(action:, exception:) ⇒ Boolean
- #static? ⇒ Boolean
Constructor Details
#initialize(matcher: nil, handler: nil) ⇒ BaseDescriptor
Returns a new instance of BaseDescriptor.
12 13 14 15 16 |
# File 'lib/axn/core/flow/handlers/base_descriptor.rb', line 12 def initialize(matcher: nil, handler: nil) @matcher = matcher @handler = handler freeze end |
Instance Attribute Details
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
18 19 20 |
# File 'lib/axn/core/flow/handlers/base_descriptor.rb', line 18 def handler @handler end |
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
18 19 20 |
# File 'lib/axn/core/flow/handlers/base_descriptor.rb', line 18 def matcher @matcher end |
Class Method Details
Instance Method Details
#matches?(action:, exception:) ⇒ Boolean
22 23 24 25 26 |
# File 'lib/axn/core/flow/handlers/base_descriptor.rb', line 22 def matches?(action:, exception:) return true if static? @matcher.call(exception:, action:) end |
#static? ⇒ Boolean
20 |
# File 'lib/axn/core/flow/handlers/base_descriptor.rb', line 20 def static? = @matcher.nil? || @matcher.static? |