Sha256: 7d23739cca3a4005b4f12a8b9a2d6f784d8d32dfed9f354c62b04e9d5dd9a675

Contents?: true

Size: 582 Bytes

Versions: 12

Compression:

Stored size: 582 Bytes

Contents

require 'dry/core/inflector'

module ROM
  class Repository
    # 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
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rom-repository-1.4.0 lib/rom/repository/command_proxy.rb
rom-repository-1.3.3 lib/rom/repository/command_proxy.rb
rom-repository-1.3.2 lib/rom/repository/command_proxy.rb
rom-repository-1.3.1 lib/rom/repository/command_proxy.rb
rom-repository-1.3.0 lib/rom/repository/command_proxy.rb
rom-repository-1.2.0 lib/rom/repository/command_proxy.rb
rom-repository-1.1.0 lib/rom/repository/command_proxy.rb
rom-repository-1.0.2 lib/rom/repository/command_proxy.rb
rom-repository-1.0.1 lib/rom/repository/command_proxy.rb
rom-repository-1.0.0 lib/rom/repository/command_proxy.rb
rom-repository-1.0.0.rc2 lib/rom/repository/command_proxy.rb
rom-repository-1.0.0.rc1 lib/rom/repository/command_proxy.rb