lib/rom/commands/delete.rb in rom-0.4.2 vs lib/rom/commands/delete.rb in rom-0.5.0

- old
+ new

@@ -1,8 +1,7 @@ module ROM module Commands - # Delete command # # This command removes tuples from its target relation # # @abstract @@ -26,19 +25,22 @@ # # @return [Array] an array with removed tuples # # @api private def execute - raise NotImplementedError, "#{self.class}##{__method__} must be implemented" + raise( + NotImplementedError, + "#{self.class}##{__method__} must be implemented" + ) end - # Return new delete command with new target + # Create a new delete command scoped to specific relation and execute it # # @api private def new(*args, &block) - self.class.new(relation, options.merge(target: relation.public_send(*args, &block))) + new_options = options.merge(target: relation.public_send(*args, &block)) + command = self.class.new(relation, new_options) + command.call end - end - end end