Class: Redshift::Client::Configuration
- Inherits:
-
Object
- Object
- Redshift::Client::Configuration
- Defined in:
- lib/redshift/client/configuration.rb
Instance Attribute Summary collapse
-
#dbname ⇒ Object
readonly
Returns the value of attribute dbname.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host, port, user, password, dbname) ⇒ Configuration
constructor
A new instance of Configuration.
- #params ⇒ Object
Constructor Details
#initialize(host, port, user, password, dbname) ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 |
# File 'lib/redshift/client/configuration.rb', line 19 def initialize(host, port, user, password, dbname) @host = host @port = port || 5439 @user = user @password = password @dbname = dbname end |
Instance Attribute Details
#dbname ⇒ Object (readonly)
Returns the value of attribute dbname.
6 7 8 |
# File 'lib/redshift/client/configuration.rb', line 6 def dbname @dbname end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
6 7 8 |
# File 'lib/redshift/client/configuration.rb', line 6 def host @host end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/redshift/client/configuration.rb', line 6 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
6 7 8 |
# File 'lib/redshift/client/configuration.rb', line 6 def port @port end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/redshift/client/configuration.rb', line 6 def user @user end |
Class Method Details
.resolve(config = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/redshift/client/configuration.rb', line 8 def self.resolve(config = {}) if config.empty? url = URI.parse(ENV["REDSHIFT_URL"]) self.new(url.host, url.port, url.user, url.password, url.path[1..-1]) else self.new(config[:host], config[:port], config[:user], config[:password], config[:dbname]) end rescue => e raise ConfigurationError.new(e.) end |
Instance Method Details
#params ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/redshift/client/configuration.rb', line 27 def params { host: @host, port: @port, user: @user, password: @password, dbname: @dbname } end |