Class: Waterfall::WhenTruthy
- Defined in:
- lib/waterfall/predicates/when_truthy.rb
Direct Known Subclasses
Instance Method Summary collapse
- #call ⇒ Object
- #condition? ⇒ Boolean
- #dam ⇒ Object
-
#initialize(root) ⇒ WhenTruthy
constructor
A new instance of WhenTruthy.
Methods inherited from Base
Constructor Details
#initialize(root) ⇒ WhenTruthy
Returns a new instance of WhenTruthy.
4 5 6 |
# File 'lib/waterfall/predicates/when_truthy.rb', line 4 def initialize(root) @root = root end |
Instance Method Details
#call ⇒ Object
8 9 10 |
# File 'lib/waterfall/predicates/when_truthy.rb', line 8 def call @output = yield(*yield_args) end |
#condition? ⇒ Boolean
19 20 21 |
# File 'lib/waterfall/predicates/when_truthy.rb', line 19 def condition? @output end |
#dam ⇒ Object
12 13 14 15 16 17 |
# File 'lib/waterfall/predicates/when_truthy.rb', line 12 def dam if !@root.dammed? && condition? @root.dam yield(*yield_args) end @root end |