Class: Arel::Value

Inherits:
Object
  • Object
show all
Defined in:
lib/arel/algebra/value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, relation) ⇒ Value

Returns a new instance of Value.



5
6
7
8
# File 'lib/arel/algebra/value.rb', line 5

def initialize value, relation
  @value = value
  @relation = relation
end

Instance Attribute Details

#relationObject (readonly)

Returns the value of attribute relation.



3
4
5
# File 'lib/arel/algebra/value.rb', line 3

def relation
  @relation
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/arel/algebra/value.rb', line 3

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
13
14
15
# File 'lib/arel/algebra/value.rb', line 10

def == other
  super ||
    Value === other &&
    value == other.value &&
    relation == other.relation
end

#bind(relation) ⇒ Object



21
22
23
# File 'lib/arel/algebra/value.rb', line 21

def bind(relation)
  Value.new(value, relation)
end

#equality_predicate_sqlObject



37
38
39
# File 'lib/arel/algebra/value.rb', line 37

def equality_predicate_sql
  value.equality_predicate_sql
end

#eval(row) ⇒ Object



17
18
19
# File 'lib/arel/algebra/value.rb', line 17

def eval(row)
  value
end

#exclusion_predicate_sqlObject



33
34
35
# File 'lib/arel/algebra/value.rb', line 33

def exclusion_predicate_sql
  value.exclusion_predicate_sql
end

#format(object) ⇒ Object



49
50
51
# File 'lib/arel/algebra/value.rb', line 49

def format(object)
  object.to_sql(Sql::Value.new(relation))
end

#inclusion_predicate_sqlObject



29
30
31
# File 'lib/arel/algebra/value.rb', line 29

def inclusion_predicate_sql
  value.inclusion_predicate_sql
end

#inequality_predicate_sqlObject



41
42
43
# File 'lib/arel/algebra/value.rb', line 41

def inequality_predicate_sql
  value.inequality_predicate_sql
end

#to_orderingObject



25
26
27
# File 'lib/arel/algebra/value.rb', line 25

def to_ordering
  self
end

#to_sql(formatter = Sql::WhereCondition.new(relation)) ⇒ Object



45
46
47
# File 'lib/arel/algebra/value.rb', line 45

def to_sql(formatter = Sql::WhereCondition.new(relation))
  formatter.value value
end