Sha256: 604371804c642c2b5b4108397c8b53fa91032dbc117d28484587c980248cbf82

Contents?: true

Size: 671 Bytes

Versions: 6

Compression:

Stored size: 671 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

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

    # @api private
    def call(input)
      command.call(root => input)
    end

    # @api private
    def >>(other)
      self.class.new(command >> other)
    end

    # @api private
    def restrictible?
      command.restrictible?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rom-core-4.0.2 lib/rom/command_proxy.rb
rom-core-4.0.1 lib/rom/command_proxy.rb
rom-core-4.0.0 lib/rom/command_proxy.rb
rom-core-4.0.0.rc2 lib/rom/command_proxy.rb
rom-core-4.0.0.rc1 lib/rom/command_proxy.rb
rom-core-4.0.0.beta3 lib/rom/command_proxy.rb