Class: Pokeedex::Configuration
- Inherits:
-
Object
- Object
- Pokeedex::Configuration
- Defined in:
- lib/pokeedex/configuration.rb
Overview
Class that holds the configuration of the gem and the database connection information and methods to connect to the database and run the migrations if needed
Instance Attribute Summary collapse
-
#db_name ⇒ Object
The name of the database file to use for the gem (default: pokeedex_local.sqlite3).
-
#db_path ⇒ Object
Return the path to the database file to use for the gem (default: /path/to/pokeedex/db/pokeedex_local.sqlite3).
Instance Method Summary collapse
-
#db_connection ⇒ Object
Return the database connection to the database file to use for the gem (default: /path/to/pokeedex/db/pokeedex_local.sqlite3).
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 |
# File 'lib/pokeedex/configuration.rb', line 18 def initialize @db_name = 'pokeedex_local.sqlite3' end |
Instance Attribute Details
#db_name ⇒ Object
The name of the database file to use for the gem (default: pokeedex_local.sqlite3)
12 13 14 |
# File 'lib/pokeedex/configuration.rb', line 12 def db_name @db_name end |
Instance Method Details
#db_connection ⇒ Object
Return the database connection to the database file to use for the gem (default: /path/to/pokeedex/db/pokeedex_local.sqlite3)
37 38 39 |
# File 'lib/pokeedex/configuration.rb', line 37 def db_connection Sequel.sqlite(db_path) end |