Class: CatalogDb::Metal::PlayerRecord

Inherits:
BaseRecord
  • Object
show all
Defined in:
lib/sportdb/catalogs/base.rb

Direct Known Subclasses

Player

Class Method Summary collapse

Methods inherited from BaseRecord

_country, _to_bool, columns, columns=, count, execute, tablename, tablename=

Class Method Details

.databaseObject



79
80
81
82
83
84
85
86
# File 'lib/sportdb/catalogs/base.rb', line 79

def self.database
   ### note: only one database for all derived records/tables!!!
   ##   thus MUST use @@ and not @!!!!!
   ##  todo - change later to built-in database
   ##   or download on request???
   @@db ||= SQLite3::Database.new( './players.db', readonly: true )
   @@db
end

.database=(path) ⇒ Object



88
89
90
91
92
93
# File 'lib/sportdb/catalogs/base.rb', line 88

def self.database=(path)
   puts "==> setting (internal) players db to: >#{path}<"
   @@db = SQLite3::Database.new( path, readonly: true )
   pp @@db
   @@db
end

.database?Boolean

lets you query if datbase setup

Returns:

  • (Boolean)


77
# File 'lib/sportdb/catalogs/base.rb', line 77

def self.database?() defined?( @@db ); end