Class: Arel::Predicates::Unary
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Predicate
#and, #complement, #not, #or
Constructor Details
#initialize(operand) ⇒ Unary
Returns a new instance of Unary.
87
88
89
|
# File 'lib/arel/algebra/predicates.rb', line 87
def initialize operand
@operand = operand
end
|
Instance Attribute Details
#operand ⇒ Object
Returns the value of attribute operand.
85
86
87
|
# File 'lib/arel/algebra/predicates.rb', line 85
def operand
@operand
end
|
Instance Method Details
#==(other) ⇒ Object
95
96
97
|
# File 'lib/arel/algebra/predicates.rb', line 95
def == other
super || self.class === other && operand == other.operand
end
|
#bind(relation) ⇒ Object
91
92
93
|
# File 'lib/arel/algebra/predicates.rb', line 91
def bind(relation)
self.class.new(operand.find_correlate_in(relation))
end
|
#eval(row) ⇒ Object
99
100
101
|
# File 'lib/arel/algebra/predicates.rb', line 99
def eval(row)
operand.eval(row).send(operator)
end
|
#to_sql(formatter = nil) ⇒ Object
103
104
105
|
# File 'lib/arel/algebra/predicates.rb', line 103
def to_sql(formatter = nil)
"#{predicate_sql} (#{operand.to_sql(formatter)})"
end
|