Class: Arel::Nodes::SelectStatement

Inherits:
NodeExpression
  • Object
show all
Defined in:
ext/arel/nodes/select_statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relation = nil) ⇒ SelectStatement

Returns a new instance of SelectStatement.



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

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

Instance Attribute Details

#eager_loadObject

Returns the value of attribute eager_load.



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

def eager_load
  @eager_load
end

Instance Method Details

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

Returns:

  • (Boolean)


29
30
31
32
33
34
35
36
37
38
# File 'ext/arel/nodes/select_statement.rb', line 29

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 &&
    self.eager_load == other.eager_load
end

#hashObject



25
26
27
# File 'ext/arel/nodes/select_statement.rb', line 25

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

#initialize_copy(other) ⇒ Object



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

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