Sha256: c9e42f8660dd33bc6c5d8de706874962e0b370013b824ff4a796bb414d28c816

Contents?: true

Size: 663 Bytes

Versions: 5

Compression:

Stored size: 663 Bytes

Contents

require 'rom/support/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 = 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

5 entries across 5 versions & 1 rubygems

Version Path
rom-core-4.2.1 lib/rom/command_proxy.rb
rom-core-4.2.0 lib/rom/command_proxy.rb
rom-core-4.1.2 lib/rom/command_proxy.rb
rom-core-4.1.1 lib/rom/command_proxy.rb
rom-core-4.1.0 lib/rom/command_proxy.rb