Sha256: 75b23c29a538ea474dca36dcd23778f7cb56da9f98dec3f1af022d1f0e57c518

Contents?: true

Size: 557 Bytes

Versions: 3

Compression:

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

3 entries across 3 versions & 1 rubygems

Version Path
rom-repository-1.0.0.beta3 lib/rom/repository/command_proxy.rb
rom-repository-1.0.0.beta2 lib/rom/repository/command_proxy.rb
rom-repository-1.0.0.beta1 lib/rom/repository/command_proxy.rb