Class: RQuery::OperationsGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/rquery/operations_group.rb

Direct Known Subclasses

AndOperationsGroup, OrOperationsGroup

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ OperationsGroup

Returns a new instance of OperationsGroup.



5
6
7
8
9
10
11
12
# File 'lib/rquery/operations_group.rb', line 5

def initialize(args)
  @operations = []
  #if the two args passed are strings make a new group
  #otherwise add the second arg to the previous operation group
  #
  # NOTE coupling by type assumption here
  @operations = args[0].instance_of?(String) ? args[0,2] : (args[0].operations << args[1])
end

Instance Attribute Details

#operationsObject

Returns the value of attribute operations.



3
4
5
# File 'lib/rquery/operations_group.rb', line 3

def operations
  @operations
end

Instance Method Details

#to_sObject



14
15
16
# File 'lib/rquery/operations_group.rb', line 14

def to_s
  RQuery::Config.adapter.send("#{@type.to_s}_group", @operations)
end