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:



350
351
352
353
354
# File 'lib/active_record/postgresql_extensions/functions.rb', line 350

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)


356
357
358
# File 'lib/active_record/postgresql_extensions/functions.rb', line 356

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

#to_sqlObject Also known as: to_s

:nodoc:



360
361
362
# File 'lib/active_record/postgresql_extensions/functions.rb', line 360

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