Class: Pipe::Reducer
- Inherits:
-
Object
- Object
- Pipe::Reducer
- Defined in:
- lib/pipe/reducer.rb
Instance Method Summary collapse
-
#initialize(config:, context:, subject:, through:) ⇒ Reducer
constructor
A new instance of Reducer.
- #reduce ⇒ Object
Constructor Details
#initialize(config:, context:, subject:, through:) ⇒ Reducer
Returns a new instance of Reducer.
3 4 5 6 7 8 |
# File 'lib/pipe/reducer.rb', line 3 def initialize(config:, context:, subject:, through:) self.config = config self.context = context self.subject = subject self.through = through end |
Instance Method Details
#reduce ⇒ Object
10 11 12 13 14 15 |
# File 'lib/pipe/reducer.rb', line 10 def reduce through.reduce(subject) { |subj, method| break subj if config.break?(subj, method, through) process(subj, method) } end |