Class: ROM::Commands::Lazy::Delete
- Inherits:
-
ROM::Commands::Lazy
- Object
- ROM::Commands::Lazy
- ROM::Commands::Lazy::Delete
- Defined in:
- lib/rom/commands/lazy/delete.rb
Overview
Lazy command wrapper for delete commands
Instance Attribute Summary
Attributes inherited from ROM::Commands::Lazy
#command, #command_proc, #evaluator
Instance Method Summary collapse
-
#call(*args) ⇒ Hash+
Execute a lazy delete command.
Methods inherited from ROM::Commands::Lazy
#>>, [], #combine, #initialize, #lazy?, #respond_to_missing?
Constructor Details
This class inherits a constructor from ROM::Commands::Lazy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ROM::Commands::Lazy
Instance Method Details
#call(*args) ⇒ Hash+
Execute a lazy delete command
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rom/commands/lazy/delete.rb', line 15 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 |