Class: RubyPitaya::DatabaseConfig
- Inherits:
-
Object
- Object
- RubyPitaya::DatabaseConfig
- Defined in:
- lib/rubypitaya/core/database_config.rb
Instance Method Summary collapse
- #config ⇒ Object
- #connection_data ⇒ Object
- #connection_data_without_database ⇒ Object
- #database_name ⇒ Object
-
#initialize ⇒ DatabaseConfig
constructor
A new instance of DatabaseConfig.
Constructor Details
#initialize ⇒ DatabaseConfig
Returns a new instance of DatabaseConfig.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rubypitaya/core/database_config.rb', line 10 def initialize() @setup = Setup.new @config = { 'adapter' => 'postgresql', 'encoding' => 'unicode', 'pool' => @setup.fetch('rubypitaya.database.pool', 5), 'host' => @setup['rubypitaya.database.host'], 'user' => @setup['rubypitaya.database.user'], 'password' => @setup['rubypitaya.database.password'], 'database' => @setup['rubypitaya.database.name'], } @config['database'] = "#{@config['database']}_test" if @environment_name == 'test' end |
Instance Method Details
#config ⇒ Object
26 27 28 |
# File 'lib/rubypitaya/core/database_config.rb', line 26 def config @config end |
#connection_data ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rubypitaya/core/database_config.rb', line 30 def connection_data { 'adapter': config['adapter'], 'encoding': config['encoding'], 'pool': config['pool'], 'host': config['host'], 'user': config['user'], 'password': config['password'], 'database': config['database'], } end |
#connection_data_without_database ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rubypitaya/core/database_config.rb', line 42 def connection_data_without_database { 'adapter': config['adapter'], 'encoding': config['encoding'], 'pool': config['pool'], 'host': config['host'], 'user': config['user'], 'password': config['password'], } end |
#database_name ⇒ Object
53 54 55 |
# File 'lib/rubypitaya/core/database_config.rb', line 53 def database_name config['database'] end |