Sha256: fab318ea95adaf4b32dea9c3e06312fe30b065382fb0d4dd7ff55987dc054990

Contents?: true

Size: 694 Bytes

Versions: 15

Compression:

Stored size: 694 Bytes

Contents

# frozen_string_literal: true

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

15 entries across 15 versions & 1 rubygems

Version Path
rom-core-5.3.2 lib/rom/command_proxy.rb
rom-core-5.3.1 lib/rom/command_proxy.rb
rom-core-5.3.0 lib/rom/command_proxy.rb
rom-core-5.2.6 lib/rom/command_proxy.rb
rom-core-5.2.5 lib/rom/command_proxy.rb
rom-core-5.2.4 lib/rom/command_proxy.rb
rom-core-5.2.3 lib/rom/command_proxy.rb
rom-core-5.2.2 lib/rom/command_proxy.rb
rom-core-5.2.1 lib/rom/command_proxy.rb
rom-core-5.1.2 lib/rom/command_proxy.rb
rom-core-5.1.1 lib/rom/command_proxy.rb
rom-core-5.1.0 lib/rom/command_proxy.rb
rom-core-5.0.2 lib/rom/command_proxy.rb
rom-core-5.0.1 lib/rom/command_proxy.rb
rom-core-5.0.0 lib/rom/command_proxy.rb