Class: Prequel::Expressions::SetFunction
- Inherits:
-
Expression
- Object
- Expression
- Prequel::Expressions::SetFunction
- Defined in:
- lib/prequel/expressions/set_function.rb
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(expression, type) ⇒ SetFunction
constructor
A new instance of SetFunction.
- #resolve_in_query(query) ⇒ Object
- #resolve_in_relations(relations) ⇒ Object
- #to_sql ⇒ Object
Methods inherited from Expression
Constructor Details
#initialize(expression, type) ⇒ SetFunction
Returns a new instance of SetFunction.
6 7 8 |
# File 'lib/prequel/expressions/set_function.rb', line 6 def initialize(expression, type) @expression, @type = expression, type end |
Instance Attribute Details
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
4 5 6 |
# File 'lib/prequel/expressions/set_function.rb', line 4 def expression @expression end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/prequel/expressions/set_function.rb', line 4 def type @type end |
Instance Method Details
#resolve_in_query(query) ⇒ Object
14 15 16 |
# File 'lib/prequel/expressions/set_function.rb', line 14 def resolve_in_query(query) SetFunction.new(expression.resolve_in_query(query), type) end |
#resolve_in_relations(relations) ⇒ Object
10 11 12 |
# File 'lib/prequel/expressions/set_function.rb', line 10 def resolve_in_relations(relations) SetFunction.new(expression.resolve_in_relations(relations), type) end |
#to_sql ⇒ Object
18 19 20 |
# File 'lib/prequel/expressions/set_function.rb', line 18 def to_sql "#{type}(#{expression.to_sql})" end |