Methods

StackDeck::Context::PgProc

Public Class Methods

new(conn, function, lineno) click to toggle source
# File lib/stackdeck/postgres.rb, line 7
def initialize(conn, function, lineno)
  # This will obviously fail on an overloaded function, returning
  # the source of one arbitrarily-chosen variant.
  src = conn.query('SELECT prosrc FROM pg_proc WHERE proname = ? ORDER BY pronargs DESC LIMIT 1', function)
  src = src.first until String === src

  lines = src.split(/\r?\n/)

  # Apparently, if the first line of the function is empty (doesn't
  # even contain any whitespace), PG doesn't count it when numbering
  # lines. So we join in, by pretending it isn't there.
  lines.shift if lines.first.empty?

  super lines, lineno
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.