class Retl::Context
Public Class Methods
new(path, options={})
click to toggle source
# File lib/retl/context.rb, line 5 def initialize(path, options={}) path.dependencies.each do |name, dependency| if dependency.nil? && !options[name] raise ArgumentError, "This transformation depends on `name`" end define_singleton_method(name) do (dependency && dependency.call(options)) || options[name] end end @_events = EventRouter.new end
Public Instance Methods
_events()
click to toggle source
# File lib/retl/context.rb, line 31 def _events @_events end
execute_step(step, data)
click to toggle source
# File lib/retl/context.rb, line 19 def execute_step(step, data) if step.is_a?(Proc) instance_exec(data, self, &step) else if step.method(:call).arity.abs == 2 step.call(data, self) else step.call(data) end end end