Class: PgMeta::Function

Inherits:
Node
  • Object
show all
Defined in:
lib/pg_meta/meta.rb

Direct Known Subclasses

Procedure

Instance Attribute Summary collapse

Attributes inherited from Node

#name, #parent, #root

Instance Method Summary collapse

Methods inherited from Node

#dump, #dump_value, #guid, #inspect, #to_s, #to_yaml, #uid

Constructor Details

#initialize(schema, name, owner, security) ⇒ Function

Returns a new instance of Function.



541
542
543
544
545
546
547
548
549
550
# File 'lib/pg_meta/meta.rb', line 541

def initialize(schema, name, owner, security)
  super(schema, name)
  @owner = owner
  @security = security.to_sym
  if function?
    schema.functions[name] = self
  else
    schema.procedures[name] = self
  end
end

Instance Attribute Details

#ownerObject (readonly)

Owner of the function



527
528
529
# File 'lib/pg_meta/meta.rb', line 527

def owner
  @owner
end

#securityObject (readonly)

Security (:definer or :invoker)



530
531
532
# File 'lib/pg_meta/meta.rb', line 530

def security
  @security
end

Instance Method Details

#function?Boolean

True if this is a function

Returns:

  • (Boolean)


536
# File 'lib/pg_meta/meta.rb', line 536

def function?() true end

#procedure?Boolean

True if this is a procedure

Returns:

  • (Boolean)


539
# File 'lib/pg_meta/meta.rb', line 539

def procedure?() !function? end

#sidObject



519
520
521
# File 'lib/pg_meta/meta.rb', line 519

def sid()
  @sid ||= name
end

#suid?Boolean

True if security is ‘definer’

Returns:

  • (Boolean)


533
# File 'lib/pg_meta/meta.rb', line 533

def suid?() security == 'definer' end

#to_hObject



552
# File 'lib/pg_meta/meta.rb', line 552

def to_h() attrs_to_h(:name, :owner, :security, :function?) end