Class: TeradataCli::Database
- Inherits:
-
Object
- Object
- TeradataCli::Database
- Defined in:
- lib/teradata-cli/dbobject.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(name, conn) ⇒ Database
constructor
A new instance of Database.
- #inspect ⇒ Object
- #invalidate_cache ⇒ Object
- #own_current_perm ⇒ Object (also: #current_perm)
- #own_max_perm ⇒ Object (also: #max_perm)
- #own_peak_perm ⇒ Object (also: #peak_perm)
- #owner ⇒ Object (also: #parent)
- #parents ⇒ Object
- #tables ⇒ Object
- #total_current_perm ⇒ Object
- #total_max_perm ⇒ Object
- #total_peak_perm ⇒ Object
- #user? ⇒ Boolean
Constructor Details
#initialize(name, conn) ⇒ Database
Returns a new instance of Database.
207 208 209 210 211 |
# File 'lib/teradata-cli/dbobject.rb', line 207 def initialize(name, conn) @name = name @connection = conn invalidate_cache end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
213 214 215 |
# File 'lib/teradata-cli/dbobject.rb', line 213 def name @name end |
Instance Method Details
#children ⇒ Object
241 242 243 |
# File 'lib/teradata-cli/dbobject.rb', line 241 def children @children ||= @connection.child_databases(@name) end |
#inspect ⇒ Object
223 224 225 |
# File 'lib/teradata-cli/dbobject.rb', line 223 def inspect "\#<#{self.class} #{@name}>" end |
#invalidate_cache ⇒ Object
215 216 217 218 219 220 221 |
# File 'lib/teradata-cli/dbobject.rb', line 215 def invalidate_cache @parents = nil @children = nil @tables = nil @own_perms = nil @total_perms = nil end |
#own_current_perm ⇒ Object Also known as: current_perm
249 250 251 252 |
# File 'lib/teradata-cli/dbobject.rb', line 249 def own_current_perm load_own_perms @own_perms.current end |
#own_max_perm ⇒ Object Also known as: max_perm
256 257 258 259 |
# File 'lib/teradata-cli/dbobject.rb', line 256 def own_max_perm load_own_perms @own_perms.max end |
#own_peak_perm ⇒ Object Also known as: peak_perm
263 264 265 266 |
# File 'lib/teradata-cli/dbobject.rb', line 263 def own_peak_perm load_own_perms @own_perms.peak end |
#owner ⇒ Object Also known as: parent
231 232 233 |
# File 'lib/teradata-cli/dbobject.rb', line 231 def owner parents.first end |
#parents ⇒ Object
237 238 239 |
# File 'lib/teradata-cli/dbobject.rb', line 237 def parents @parents ||= @connection.parent_databases(@name) end |
#tables ⇒ Object
245 246 247 |
# File 'lib/teradata-cli/dbobject.rb', line 245 def tables @tables ||= @connection.tables(@name) end |
#total_current_perm ⇒ Object
275 276 277 278 |
# File 'lib/teradata-cli/dbobject.rb', line 275 def total_current_perm load_total_perms @total_perms.current end |
#total_max_perm ⇒ Object
280 281 282 283 |
# File 'lib/teradata-cli/dbobject.rb', line 280 def total_max_perm load_total_perms @total_perms.max end |
#total_peak_perm ⇒ Object
285 286 287 288 |
# File 'lib/teradata-cli/dbobject.rb', line 285 def total_peak_perm load_total_perms @total_perms.peak end |
#user? ⇒ Boolean
227 228 229 |
# File 'lib/teradata-cli/dbobject.rb', line 227 def user? false end |