Class: Pipe::Iterator

Inherits:
Object
  • Object
show all
Defined in:
lib/pipe/iterator.rb

Instance Method Summary collapse

Constructor Details

#initialize(config:, context:, subjects:, through:) ⇒ Iterator

Returns a new instance of Iterator.



3
4
5
6
7
8
# File 'lib/pipe/iterator.rb', line 3

def initialize(config:, context:, subjects:, through:)
  self.config = config
  self.context = context
  self.subjects = subjects
  self.through = through
end

Instance Method Details

#iterateObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/pipe/iterator.rb', line 10

def iterate
  subjects.map { |subject|
    Reducer.new(
      config: config,
      context: context,
      subject: subject,
      through: through
    ).reduce
  }
end