Class: ActiveRecord::ConnectionAdapters::PostgreSQLFunctionAlterer

Inherits:
PostgreSQLFunction show all
Defined in:
lib/active_record/postgresql_extensions/functions.rb

Overview

Alters a function. You’ll generally want to be calling the PostgreSQLAdapter#alter_function method rather than risk messing with this class directly. It’s a finicky, delicate flower.

Instance Attribute Summary

Attributes inherited from PostgreSQLFunction

#args, #base, #name, #options

Instance Method Summary collapse

Constructor Details

#initialize(base, name, args, options = {}) ⇒ PostgreSQLFunctionAlterer

:nodoc:



300
301
302
303
304
# File 'lib/active_record/postgresql_extensions/functions.rb', line 300

def initialize(base, name, args, options = {}) #:nodoc:
  super(base, name, args, options)

  @sql = options.collect { |k, v| build_statement(k, v) }
end

Instance Method Details

#empty?Boolean

:nodoc:

Returns:

  • (Boolean)


306
307
308
# File 'lib/active_record/postgresql_extensions/functions.rb', line 306

def empty? #:nodoc:
  @sql.empty?
end

#to_sqlObject Also known as: to_s

:nodoc:



310
311
312
# File 'lib/active_record/postgresql_extensions/functions.rb', line 310

def to_sql #:nodoc:
  "#{@sql.join(";\n")};"
end