class Rookout::Processor::Operations::SetOperation

Public Class Methods

new(configuration, factory) click to toggle source
# File lib/rookout/processor/operations/set_operation.rb, line 13
def initialize configuration, factory
  @paths = []

  configuration["paths"].each do |key, value|
    begin
      dest_path = factory.create_path key
      source_path = factory.create_path value
      @paths.push [dest_path, source_path]
    rescue StandardError => e
      message = "Failed to load dest:source path pair"
      Logger.instance.exception message, e
      warning = RookError.new e, message
      UserWarnings.notify_warning warning
    end
  end
end

Public Instance Methods

execute(namespace) click to toggle source
# File lib/rookout/processor/operations/set_operation.rb, line 30
def execute namespace
  @paths.each do |dest_path, source_path|
    begin
      value = source_path.read_from namespace
      if value.is_a?(Namespaces::RubyObjectNamespace) &&
         value.dump_config == Namespaces::OBJECT_DUMP_CONFIG_DEFAULT
        value.tailor_limits!
      end

      dest_path.write_to namespace, value
    rescue StandardError => e
      message = "Failed to execute dest:source path pair"
      Logger.instance.exception message, e
      warning = RookError.new e, message
      UserWarnings.notify_warning warning
    end
  end
end