Class: Brine::Performing::CollectingPerformer

Inherits:
Object
  • Object
show all
Defined in:
lib/brine/performing.rb

Overview

A Peformer which collects rather than evaluating actions.

Instance Method Summary collapse

Constructor Details

#initializeCollectingPerformer

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

#evaluateObject

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.

Parameters:

  • A (Proc)

    thunk of actions to be performed.



48
49
50
# File 'lib/brine/performing.rb', line 48

def perform(actions)
  @actions << actions
end