Class: Believer::FilterCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/believer/filter_command.rb

Overview

A command implementation which includes a CQL WHERE clause

Direct Known Subclasses

BatchDelete, Delete, Query, Update

Instance Attribute Summary

Attributes inherited from Command

#consistency_level, #record_class

Instance Method Summary collapse

Methods inherited from Command

#can_execute?, #clone, #command_name, #consistency, #execute, #execution_options, #execution_options=, #initialize, #override_execution_options

Constructor Details

This class inherits a constructor from Believer::Command

Instance Method Details

#query_attributesObject



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

def query_attributes
  attrs = super
  attrs.merge(:wheres => (wheres.dup))
end

#where(*args) ⇒ Object



18
19
20
21
22
# File 'lib/believer/filter_command.rb', line 18

def where(*args)
  q = clone
  q.wheres << WhereClause.new(*args)
  q
end

#wheresObject



10
11
12
# File 'lib/believer/filter_command.rb', line 10

def wheres
  @wheres ||= []
end

#wheres=(w) ⇒ Object



14
15
16
# File 'lib/believer/filter_command.rb', line 14

def wheres=(w)
  @wheres = w.is_a?(Array) ? w : [w]
end