Class: PGExaminer::Result

Inherits:
Base
  • Object
show all
Defined in:
lib/pg_examiner/result.rb,
lib/pg_examiner/result/item.rb,
lib/pg_examiner/result/index.rb,
lib/pg_examiner/result/table.rb,
lib/pg_examiner/result/column.rb,
lib/pg_examiner/result/schema.rb,
lib/pg_examiner/result/trigger.rb,
lib/pg_examiner/result/function.rb,
lib/pg_examiner/result/language.rb,
lib/pg_examiner/result/sequence.rb,
lib/pg_examiner/result/extension.rb,
lib/pg_examiner/result/constraint.rb

Defined Under Namespace

Classes: Column, Constraint, Extension, Function, Index, Item, Language, Schema, Sequence, Table, Trigger

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #diff, #diffable_attrs, #diffable_methods

Constructor Details

#initialize(connection) ⇒ Result

Returns a new instance of Result.



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

def initialize(connection)
  @conn = connection
  load_schema
end

Instance Attribute Details

#pg_attrdefObject (readonly)

Returns the value of attribute pg_attrdef.



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

def pg_attrdef
  @pg_attrdef
end

#pg_attributeObject (readonly)

Returns the value of attribute pg_attribute.



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

def pg_attribute
  @pg_attribute
end

#pg_classObject (readonly)

Returns the value of attribute pg_class.



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

def pg_class
  @pg_class
end

#pg_constraintObject (readonly)

Returns the value of attribute pg_constraint.



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

def pg_constraint
  @pg_constraint
end

#pg_extensionObject (readonly)

Returns the value of attribute pg_extension.



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

def pg_extension
  @pg_extension
end

#pg_indexObject (readonly)

Returns the value of attribute pg_index.



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

def pg_index
  @pg_index
end

#pg_languageObject (readonly)

Returns the value of attribute pg_language.



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

def pg_language
  @pg_language
end

#pg_namespaceObject (readonly)

Returns the value of attribute pg_namespace.



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

def pg_namespace
  @pg_namespace
end

#pg_procObject (readonly)

Returns the value of attribute pg_proc.



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

def pg_proc
  @pg_proc
end

#pg_triggerObject (readonly)

Returns the value of attribute pg_trigger.



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

def pg_trigger
  @pg_trigger
end

#pg_typeObject (readonly)

Returns the value of attribute pg_type.



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

def pg_type
  @pg_type
end

Instance Method Details

#diffable_listsObject



24
25
26
27
28
29
30
# File 'lib/pg_examiner/result.rb', line 24

def diffable_lists
  {
    "schemas"    => "schemas",
    "extensions" => "extensions",
    "languages"  => "languages",
  }
end

#extensionsObject



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

def extensions
  @extensions ||= @pg_extension.map{|row| Extension.new(self, row)}.sort_by(&:name)
end

#inspectObject



44
45
46
# File 'lib/pg_examiner/result.rb', line 44

def inspect
  "#<#{self.class} @schemas=#{@schemas.inspect}, @extensions=#{@extensions.inspect}>"
end

#languagesObject



40
41
42
# File 'lib/pg_examiner/result.rb', line 40

def languages
  @languages ||= @pg_language.map{|row| Language.new(self, row)}.sort_by(&:name)
end

#schemasObject



32
33
34
# File 'lib/pg_examiner/result.rb', line 32

def schemas
  @schemas ||= @pg_namespace.map{|row| Schema.new(self, row)}.sort_by(&:name)
end