Class: Arel::Nodes::Exists

Inherits:
Unary
  • Object
show all
Includes:
OrderPredications, Predications, WindowPredications
Defined in:
lib/arel/extensions/exists.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expr, aliaz = nil) ⇒ Exists

Returns a new instance of Exists.



23
24
25
26
27
# File 'lib/arel/extensions/exists.rb', line 23

def initialize(expr, aliaz = nil)
  @expressions = expr
  @alias       = aliaz && SqlLiteral.new(aliaz)
  @distinct    = false
end

Instance Attribute Details

#aliasObject

Returns the value of attribute alias.



21
22
23
# File 'lib/arel/extensions/exists.rb', line 21

def alias
  @alias
end

#distinctObject

Returns the value of attribute distinct.



21
22
23
# File 'lib/arel/extensions/exists.rb', line 21

def distinct
  @distinct
end

#expressionsObject

Returns the value of attribute expressions.



21
22
23
# File 'lib/arel/extensions/exists.rb', line 21

def expressions
  @expressions
end

Instance Method Details

#as(aliaz) ⇒ Object



29
30
31
32
# File 'lib/arel/extensions/exists.rb', line 29

def as(aliaz)
  self.alias = SqlLiteral.new(aliaz)
  self
end

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

Returns:

  • (Boolean)


38
39
40
41
42
43
# File 'lib/arel/extensions/exists.rb', line 38

def eql?(other)
  self.class == other.class &&
    expressions == other.expressions &&
    self.alias == other.alias &&
    distinct == other.distinct
end

#hashObject



34
35
36
# File 'lib/arel/extensions/exists.rb', line 34

def hash
  [@expressions, @alias, @distinct].hash
end