Class: PGExaminer::Result::Extension

Inherits:
Item
  • Object
show all
Defined in:
lib/pg_examiner/result/extension.rb

Instance Attribute Summary

Attributes inherited from Item

#parent, #result, #row

Instance Method Summary collapse

Methods inherited from Item

#inspect, #name, #oid

Methods inherited from Base

#==, #diff, #diffable_lists

Constructor Details

#initialize(*args) ⇒ Extension

Returns a new instance of Extension.



6
7
8
9
# File 'lib/pg_examiner/result/extension.rb', line 6

def initialize(*args)
  super
  @schema_calculated = false
end

Instance Method Details

#diffable_attrsObject



11
12
13
14
15
16
# File 'lib/pg_examiner/result/extension.rb', line 11

def diffable_attrs
  {
    "name"       => "name",
    "extversion" => "extension version",
  }
end

#diffable_methodsObject



18
19
20
21
22
# File 'lib/pg_examiner/result/extension.rb', line 18

def diffable_methods
  {
    "schema_name" => "schema name"
  }
end

#schemaObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pg_examiner/result/extension.rb', line 24

def schema
  # Extensions installed in system schemas won't be returned, so @schema
  # will be nil in that case.

  if @schema_calculated
    @schema
  else
    @schema_calculated = true
    @schema = result.schemas.find{|s| s.oid == row['extnamespace']}
  end
end

#schema_nameObject



36
37
38
# File 'lib/pg_examiner/result/extension.rb', line 36

def schema_name
  schema && schema.name
end