Sha256: efc28eb45a0ec565ec0ddf78ad517ff357ddbb7c97a056092486ae701f8d24be

Contents?: true

Size: 523 Bytes

Versions: 2

Compression:

Stored size: 523 Bytes

Contents

require 'dry/core/inflector'

module ROM
  # TODO: look into making command graphs work without the root key in the input
  #       so that we can get rid of this wrapper
  #
  # @api private
  class CommandProxy
    attr_reader :command, :root

    def initialize(command)
      @command = command
      @root = Dry::Core::Inflector.singularize(command.name.relation).to_sym
    end

    def call(input)
      command.call(root => input)
    end

    def >>(other)
      self.class.new(command >> other)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-core-4.0.0.beta2 lib/rom/command_proxy.rb
rom-core-4.0.0.beta1 lib/rom/command_proxy.rb