Class: Brine::Performing::CollectingPerformer
- Inherits:
-
Object
- Object
- Brine::Performing::CollectingPerformer
- Defined in:
- lib/brine/performing.rb
Overview
A Peformer which collects rather than evaluating actions.
Instance Method Summary collapse
-
#evaluate ⇒ Object
Evaluate the collected actions in sequence.
-
#initialize ⇒ CollectingPerformer
constructor
Construct an instance with an empty collection of actions.
-
#perform(actions) ⇒ Object
Collect provided actions for later evaluation.
Constructor Details
#initialize ⇒ CollectingPerformer
Construct an instance with an empty collection of actions.
39 40 41 |
# File 'lib/brine/performing.rb', line 39 def initialize @actions = [] end |
Instance Method Details
#evaluate ⇒ Object
Evaluate the collected actions in sequence.
55 56 57 |
# File 'lib/brine/performing.rb', line 55 def evaluate @actions.each { |it| it.call } end |
#perform(actions) ⇒ Object
Collect provided actions for later evaluation.
48 49 50 |
# File 'lib/brine/performing.rb', line 48 def perform(actions) @actions << actions end |