Class: Believer::Delete

Inherits:
ScopedCommand show all
Defined in:
lib/believer/delete.rb

Instance Attribute Summary

Attributes inherited from ScopedCommand

#wheres

Attributes inherited from Command

#record_class

Instance Method Summary collapse

Methods inherited from ScopedCommand

#query_attributes, #where

Methods inherited from Command

#clone, #connection, #execute, #initialize, #query_attributes

Constructor Details

This class inherits a constructor from Believer::Command

Instance Method Details

#to_cqlObject



4
5
6
7
8
# File 'lib/believer/delete.rb', line 4

def to_cql
  cql = "DELETE FROM #{@record_class.table_name}"
  cql << " WHERE #{@wheres.map { |wc| "#{wc.to_cql}" }.join(' AND ')}" if @wheres && @wheres.any?
  cql
end