Class: Believer::ScopedCommand

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

Direct Known Subclasses

BatchDelete, Delete, Query

Instance Attribute Summary collapse

Attributes inherited from Command

#record_class

Instance Method Summary collapse

Methods inherited from Command

#clone, #connection, #execute, #initialize

Constructor Details

This class inherits a constructor from Believer::Command

Instance Attribute Details

#wheresObject

Returns the value of attribute wheres.



4
5
6
# File 'lib/believer/scoped_command.rb', line 4

def wheres
  @wheres
end

Instance Method Details

#query_attributesObject



6
7
8
9
# File 'lib/believer/scoped_command.rb', line 6

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

#where(*args) ⇒ Object



11
12
13
14
15
16
# File 'lib/believer/scoped_command.rb', line 11

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