Class: Pgchief::Command::RetrieveConnectionString
- Defined in:
- lib/pgchief/command/retrieve_connection_string.rb
Overview
Class to view database connection string
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(username, database = nil) ⇒ RetrieveConnectionString
constructor
A new instance of RetrieveConnectionString.
Methods inherited from Base
Constructor Details
#initialize(username, database = nil) ⇒ RetrieveConnectionString
Returns a new instance of RetrieveConnectionString.
9 10 11 12 13 |
# File 'lib/pgchief/command/retrieve_connection_string.rb', line 9 def initialize(username, database = nil) @username = username @database = database @connection_string = nil end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
7 8 9 |
# File 'lib/pgchief/command/retrieve_connection_string.rb', line 7 def database @database end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/pgchief/command/retrieve_connection_string.rb', line 7 def username @username end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/pgchief/command/retrieve_connection_string.rb', line 15 def call File.foreach(Config.credentials_file) do |line| @connection_string = line if regex.match?(line) end @connection_string.nil? ? 'No connection string found' : @connection_string end |