Class: Arel::Value
- Inherits:
-
Object
- Object
- Arel::Value
- Defined in:
- lib/arel/algebra/value.rb
Instance Attribute Summary collapse
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #bind(relation) ⇒ Object
- #equality_predicate_sql ⇒ Object
- #eval(row) ⇒ Object
- #exclusion_predicate_sql ⇒ Object
- #format(object) ⇒ Object
- #inclusion_predicate_sql ⇒ Object
- #inequality_predicate_sql ⇒ Object
-
#initialize(value, relation) ⇒ Value
constructor
A new instance of Value.
- #to_ordering ⇒ Object
- #to_sql(formatter = Sql::WhereCondition.new(relation)) ⇒ Object
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
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
3 4 5 |
# File 'lib/arel/algebra/value.rb', line 3 def relation @relation end |
#value ⇒ Object (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_sql ⇒ Object
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_sql ⇒ Object
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_sql ⇒ Object
29 30 31 |
# File 'lib/arel/algebra/value.rb', line 29 def inclusion_predicate_sql value.inclusion_predicate_sql end |
#inequality_predicate_sql ⇒ Object
41 42 43 |
# File 'lib/arel/algebra/value.rb', line 41 def inequality_predicate_sql value.inequality_predicate_sql end |
#to_ordering ⇒ Object
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 |