class Retl::DefaultExecution

Public Class Methods

new(enumerable, path, context, errors) click to toggle source
# File lib/retl/default_execution.rb, line 3
def initialize(enumerable, path, context, errors)
  @enumerable, @path, @context, @errors = enumerable, path, context, errors
  @executed = false
end

Public Instance Methods

each(&block) click to toggle source
# File lib/retl/default_execution.rb, line 8
def each(&block)
  @executed = true
  @enumerable.each do |data|
    execute(data, &block)
  end
end
execute(input) { |data| ... } click to toggle source
# File lib/retl/default_execution.rb, line 15
def execute(input)
  @path.call(input, @context).each do |data|
    yield data if block_given?
  end
rescue StepExecutionError => e
  if Retl.configuration.raise_errors
    raise e
  else
    @errors << e
  end
end
executed?() click to toggle source
# File lib/retl/default_execution.rb, line 41
def executed?
  @executed
end
load_into(*destinations) click to toggle source
# File lib/retl/default_execution.rb, line 27
def load_into(*destinations)
  destinations = Array(destinations)

  each do |data|
    destinations.each do |destination|
      destination << data
    end
  end

  destinations.each do |destination|
    destination.close if destination.respond_to?(:close)
  end
end