Class: PGB::FunctionCall

Inherits:
Expression show all
Defined in:
lib/pgb/function_call.rb

Instance Method Summary collapse

Methods included from SQLDisplayable

#inspect, #to_s

Constructor Details

#initialize(function, *args) ⇒ FunctionCall

Returns a new instance of FunctionCall.



5
6
7
8
# File 'lib/pgb/function_call.rb', line 5

def initialize(function, *args)
  @function = function.to_s.upcase
  @args = args.map { to_expression(_1) }
end

Instance Method Details

#to_sqlObject



10
11
12
# File 'lib/pgb/function_call.rb', line 10

def to_sql
  "#{function}(#{args.map(&:to_sql).join(', ')})"
end