Class: PgGraph::Data::DatabaseObject

Inherits:
Node
  • Object
show all
Defined in:
lib/pg_graph/data/data.rb

Direct Known Subclasses

Database, Field, Record, Schema, Table

Instance Attribute Summary

Attributes inherited from Node

#dimension, #type

Instance Method Summary collapse

Methods inherited from Node

#data, #inspect, #object, #to_h, #to_yaml, #value, #value_type

Constructor Details

#initialize(*args, **opts) ⇒ DatabaseObject

Returns a new instance of DatabaseObject.



67
68
69
70
# File 'lib/pg_graph/data/data.rb', line 67

def initialize(*args, **opts)
  super
  database.send(:add_object, self)
end

Instance Method Details

#<=>(other) ⇒ Object

def ==(other) raise PgGraph::NotThis end



74
# File 'lib/pg_graph/data/data.rb', line 74

def <=>(other) uid <=> other.uid end

#databaseObject

The database (Data::Database) of this objectD. It is defined “globally” because #dot requires quick access to the containing database

Raises:

  • (NotThis)


54
# File 'lib/pg_graph/data/data.rb', line 54

def database() raise NotThis end

#dot(path) ⇒ Object



72
# File 'lib/pg_graph/data/data.rb', line 72

def dot(path) database.dot["#{uid}.#{path}"] end

#guidObject

Global unique id including database



62
# File 'lib/pg_graph/data/data.rb', line 62

def guid() type.guid end

#nameObject

Name of object. Defaults to the name of the type



65
# File 'lib/pg_graph/data/data.rb', line 65

def name() type.name end

#uidObject

Unique id within a database. Note that #uid has to be defined before #initialize is called as it uses the UID as a key in the database-wide lookup table



59
# File 'lib/pg_graph/data/data.rb', line 59

def uid() type.uid end