Class: PLSQL::Package

Inherits:
Object
  • Object
show all
Extended by:
PackageClassMethods
Defined in:
lib/plsql/package.rb

Instance Method Summary collapse

Methods included from PackageClassMethods

find

Constructor Details

#initialize(schema, package) ⇒ Package

Returns a new instance of Package.



21
22
23
24
25
# File 'lib/plsql/package.rb', line 21

def initialize(schema, package)
  @schema = schema
  @package = package.to_s.upcase
  @procedures = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)



29
30
31
32
33
34
35
36
37
38
# File 'lib/plsql/package.rb', line 29

def method_missing(method, *args)
  if procedure = @procedures[method]
    procedure.exec(*args)
  elsif procedure = Procedure.find(@schema, method, @package)
    @procedures[method] = procedure
    procedure.exec(*args)
  else
    raise ArgumentError, "No PL/SQL procedure found"
  end
end