Class: Workflow::Event::Conditions
- Inherits:
-
Object
- Object
- Workflow::Event::Conditions
- Defined in:
- lib/workflow/event.rb
Overview
:nodoc:#
Instance Method Summary collapse
- #apply?(target) ⇒ Boolean
-
#initialize(**options, &block) ⇒ Conditions
constructor
A new instance of Conditions.
- #inspect ⇒ Object
Constructor Details
#initialize(**options, &block) ⇒ Conditions
Returns a new instance of Conditions.
47 48 49 50 51 52 |
# File 'lib/workflow/event.rb', line 47 def initialize(**, &block) @if = Array([:if]) @unless = Array([:unless]) @if << block if block_given? @conditions_lambdas = conditions_lambdas end |
Instance Method Details
#apply?(target) ⇒ Boolean
58 59 60 |
# File 'lib/workflow/event.rb', line 58 def apply?(target) @conditions_lambdas.all?{|l| l.call(target)} end |
#inspect ⇒ Object
54 55 56 |
# File 'lib/workflow/event.rb', line 54 def inspect "if: #{@if}, unless: #{@unless}" end |