Class: DataStore
- Inherits:
-
Object
- Object
- DataStore
- Includes:
- Singleton
- Defined in:
- lib/bb_analytics/models/data_store.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
Returns the value of attribute db.
Instance Method Summary collapse
- #clear_data ⇒ Object
- #db_location ⇒ Object
-
#initialize ⇒ DataStore
constructor
A new instance of DataStore.
- #setup_db ⇒ Object
Constructor Details
#initialize ⇒ DataStore
Returns a new instance of DataStore.
9 10 11 |
# File 'lib/bb_analytics/models/data_store.rb', line 9 def initialize self.setup_db end |
Instance Attribute Details
#db ⇒ Object
Returns the value of attribute db.
7 8 9 |
# File 'lib/bb_analytics/models/data_store.rb', line 7 def db @db end |
Instance Method Details
#clear_data ⇒ Object
49 50 51 52 |
# File 'lib/bb_analytics/models/data_store.rb', line 49 def clear_data File.delete(db_location) rescue nil #self.setup_db end |
#db_location ⇒ Object
58 59 60 |
# File 'lib/bb_analytics/models/data_store.rb', line 58 def db_location "#{ENV['HOME']}/.bb_analytics/bba.db" end |
#setup_db ⇒ Object
54 55 56 |
# File 'lib/bb_analytics/models/data_store.rb', line 54 def setup_db self.db = SQLite3::Database.new self.db_location rescue nil end |