Class: Hanami::CLI::Commands::App::DB::Utils::DatabaseConfig Private
- Inherits:
-
Object
- Object
- Hanami::CLI::Commands::App::DB::Utils::DatabaseConfig
- Defined in:
- lib/hanami/cli/commands/app/db/utils/database_config.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #uri ⇒ Object readonly private
Instance Method Summary collapse
- #db_name ⇒ Object private
- #db_type ⇒ Object private
- #hostname ⇒ Object (also: #host) private
-
#initialize(database_url) ⇒ DatabaseConfig
constructor
private
A new instance of DatabaseConfig.
- #password ⇒ Object (also: #pass) private
- #port ⇒ Object private
- #user ⇒ Object (also: #username) private
Constructor Details
#initialize(database_url) ⇒ DatabaseConfig
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of DatabaseConfig.
18 19 20 |
# File 'lib/hanami/cli/commands/app/db/utils/database_config.rb', line 18 def initialize(database_url) @uri = URI(database_url) end |
Instance Attribute Details
#uri ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/hanami/cli/commands/app/db/utils/database_config.rb', line 15 def uri @uri end |
Instance Method Details
#db_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/hanami/cli/commands/app/db/utils/database_config.rb', line 46 def db_name @db_name ||= uri.path.gsub(/\A\//, "") end |
#db_type ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 |
# File 'lib/hanami/cli/commands/app/db/utils/database_config.rb', line 51 def db_type uri.scheme end |
#hostname ⇒ Object Also known as: host
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/hanami/cli/commands/app/db/utils/database_config.rb', line 23 def hostname uri.hostname end |
#password ⇒ Object Also known as: pass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 |
# File 'lib/hanami/cli/commands/app/db/utils/database_config.rb', line 35 def password uri.password end |
#port ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 |
# File 'lib/hanami/cli/commands/app/db/utils/database_config.rb', line 41 def port uri.port end |
#user ⇒ Object Also known as: username
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/hanami/cli/commands/app/db/utils/database_config.rb', line 29 def user uri.user end |