Class: Database
- Inherits:
-
Object
- Object
- Database
- Defined in:
- lib/peekdb/database.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#relations ⇒ Object
readonly
Returns the value of attribute relations.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
-
#initialize(name) ⇒ Database
constructor
A new instance of Database.
Constructor Details
#initialize(name) ⇒ Database
Returns a new instance of Database.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/peekdb/database.rb', line 5 def initialize(name) @name = name begin open_connection(@name) puts "... Inspecting database #{@name}" find_tables puts "... Found #{@tables.size} tables" find_relations puts "... Found #{@relations.size} relations" rescue Exception => e puts "... Error FATAL: #{e}" exit(1) end end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/peekdb/database.rb', line 3 def connection @connection end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/peekdb/database.rb', line 3 def name @name end |
#relations ⇒ Object (readonly)
Returns the value of attribute relations.
3 4 5 |
# File 'lib/peekdb/database.rb', line 3 def relations @relations end |
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
3 4 5 |
# File 'lib/peekdb/database.rb', line 3 def tables @tables end |