Class: Arel::Nodes::SelectStatement

Inherits:
Node
  • Object
show all
Defined in:
lib/arel/nodes/select_statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#_caller, #and, #each, #not, #or, #to_sql

Methods included from FactoryMethods

#create_and, #create_false, #create_join, #create_on, #create_string_join, #create_table_alias, #create_true, #grouping, #lower

Constructor Details

#initialize(cores = [SelectCore.new]) ⇒ SelectStatement

Returns a new instance of SelectStatement.



8
9
10
11
12
13
14
15
16
# File 'lib/arel/nodes/select_statement.rb', line 8

def initialize cores = [SelectCore.new]
  super()
  @cores          = cores
  @orders         = []
  @limit          = nil
  @lock           = nil
  @offset         = nil
  @with           = nil
end

Instance Attribute Details

#coresObject (readonly)

Returns the value of attribute cores.



5
6
7
# File 'lib/arel/nodes/select_statement.rb', line 5

def cores
  @cores
end

#limitObject

Returns the value of attribute limit.



6
7
8
# File 'lib/arel/nodes/select_statement.rb', line 6

def limit
  @limit
end

#lockObject

Returns the value of attribute lock.



6
7
8
# File 'lib/arel/nodes/select_statement.rb', line 6

def lock
  @lock
end

#offsetObject

Returns the value of attribute offset.



6
7
8
# File 'lib/arel/nodes/select_statement.rb', line 6

def offset
  @offset
end

#ordersObject

Returns the value of attribute orders.



6
7
8
# File 'lib/arel/nodes/select_statement.rb', line 6

def orders
  @orders
end

#withObject

Returns the value of attribute with.



6
7
8
# File 'lib/arel/nodes/select_statement.rb', line 6

def with
  @with
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
36
# File 'lib/arel/nodes/select_statement.rb', line 28

def eql? other
  self.class == other.class &&
    self.cores == other.cores &&
    self.orders == other.orders &&
    self.limit == other.limit &&
    self.lock == other.lock &&
    self.offset == other.offset &&
    self.with == other.with
end

#hashObject



24
25
26
# File 'lib/arel/nodes/select_statement.rb', line 24

def hash
  [@cores, @orders, @limit, @lock, @offset, @with].hash
end

#initialize_copy(other) ⇒ Object



18
19
20
21
22
# File 'lib/arel/nodes/select_statement.rb', line 18

def initialize_copy other
  super
  @cores  = @cores.map { |x| x.clone }
  @orders = @orders.map { |x| x.clone }
end