Sha256: 3771e4e030ae608abedae0d43e0f33ac3acdcc2132eb7271cd91a5082caba5c8

Contents?: true

Size: 894 Bytes

Versions: 16

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

module ROM
  module Commands
    class Lazy
      # Lazy command wrapper for delete commands
      #
      # @api public
      class Delete < Lazy
        # Execute a lazy delete command
        #
        # @see Commands::Delete#call
        #
        # @return [Hash, Array<Hash>]
        #
        # @api public
        def call(*args)
          first = args.first
          last = args.last
          size = args.size

          if size > 1 && last.is_a?(Array)
            raise NotImplementedError
          else
            input = evaluator.call(first)

            if input.is_a?(Array)
              input.map do |item|
                command_proc[command, *(size > 1 ? [last, item] : [input])].call
              end
            else
              command_proc[command, input].call
            end
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

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