Sha256: 16f1ebc21441a61982347274a7346c7d78309cae03e47144fc247e6458da8d18

Contents?: true

Size: 436 Bytes

Versions: 3

Compression:

Stored size: 436 Bytes

Contents

module Interactor

  module ClassMethods

    def perform_on(obj, *arguments)
      perform(*arguments).tap do |instance|
        instance.context.each do |key, value|
          obj.send(:instance_variable_set, :"@#{ key }", value)
        end
      end
    end

  end

  # InstanceMethods

  def perform_on(obj)
    perform
    context.each do |key, value|
      obj.send(:instance_variable_set, :"@#{ key }", value)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
interactor-copy_context-0.0.3 lib/interactor/ext/interactor.rb
interactor-copy_context-0.0.2 lib/interactor/ext/interactor.rb
interactor-copy_context-0.0.1 lib/interactor/ext/interactor.rb