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
20
21
22
23
24
# File 'lib/pipe/iterator.rb', line 10

def iterate
  subjects.map { |subject|
    begin
      Reducer.new(
        config: config,
        context: context,
        subject: subject,
        through: through
      ).reduce
    rescue => e
      handle_error(:error => e, :subject => subject)
      subject
    end
  }
end