Class: Prequel::Expressions::SetFunction

Inherits:
Expression
  • Object
show all
Defined in:
lib/prequel/expressions/set_function.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

#as

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

#expressionObject (readonly)

Returns the value of attribute expression.



4
5
6
# File 'lib/prequel/expressions/set_function.rb', line 4

def expression
  @expression
end

#typeObject (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_sqlObject



18
19
20
# File 'lib/prequel/expressions/set_function.rb', line 18

def to_sql
  "#{type}(#{expression.to_sql})"
end