class Retl::Transformation
Attributes
execution_strategy[W]
Public Class Methods
new(enumerable, path, options={})
click to toggle source
# File lib/retl/transformation.rb, line 13 def initialize(enumerable, path, options={}) @enumerable, @path, @options = enumerable, path, options @context = Context.new(@path, @options) @fork_data = ForkDataCollector.new(@context) @forks = {} @errors = [] self.execution_strategy = DefaultExecution end
Public Instance Methods
each(&block)
click to toggle source
# File lib/retl/transformation.rb, line 26 def each(&block) @execution_strategy.each(&block) end
each_slice(size) { |transformed_slice| ... }
click to toggle source
# File lib/retl/transformation.rb, line 30 def each_slice(size, &block) @enumerable.each_slice(size).map do |slice| Transformation.new(slice, @path, @options).tap do |transformed_slice| yield transformed_slice if block_given? end end end
errors()
click to toggle source
# File lib/retl/transformation.rb, line 52 def errors @errors.each end
forks(name)
click to toggle source
# File lib/retl/transformation.rb, line 38 def forks(name) unless @forks[name] each unless @execution_strategy.executed? @forks[name] = @path.forks(name).transform(@fork_data.take(name), @options) @forks[name].execution_strategy = @execution_strategy.class end @forks[name] end
load_into(*destinations)
click to toggle source
# File lib/retl/transformation.rb, line 48 def load_into(*destinations) @execution_strategy.load_into(*destinations) end