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.
48 49 50 51 52 53 |
# File 'lib/workflow/event.rb', line 48 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
59 60 61 62 |
# File 'lib/workflow/event.rb', line 59 def apply?(target) # TODO: Remove the second parameter from the conditions below. @conditions_lambdas.all?{|l| l.call(target, ->(){})} end |
#inspect ⇒ Object
55 56 57 |
# File 'lib/workflow/event.rb', line 55 def inspect "if: #{@if}, unless: #{@unless}" end |