Class: SchemaEvolutionManager::ConnectionData
- Inherits:
-
Object
- Object
- SchemaEvolutionManager::ConnectionData
- Defined in:
- lib/schema-evolution-manager/connection_data.rb
Constant Summary collapse
- DEFAULT_PORT =
5432
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(host, name, opts = {}) ⇒ ConnectionData
constructor
A new instance of ConnectionData.
-
#pgpass(password = nil) ⇒ Object
Returns a valid pgpass line entry representing this connection.
Constructor Details
#initialize(host, name, opts = {}) ⇒ ConnectionData
Returns a new instance of ConnectionData.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/schema-evolution-manager/connection_data.rb', line 9 def initialize(host, name, opts={}) @host = host @name = name port = opts.delete(:port).to_s if port.to_s.empty? @port = DEFAULT_PORT else @port = port.to_i end Preconditions.check_argument(@port > 0, "Port must be > 0") @user = opts.delete(:user) Preconditions.assert_empty_opts(opts) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/schema-evolution-manager/connection_data.rb', line 7 def host @host end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/schema-evolution-manager/connection_data.rb', line 7 def name @name end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
7 8 9 |
# File 'lib/schema-evolution-manager/connection_data.rb', line 7 def port @port end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
7 8 9 |
# File 'lib/schema-evolution-manager/connection_data.rb', line 7 def user @user end |
Instance Method Details
#pgpass(password = nil) ⇒ Object
Returns a valid pgpass line entry representing this connection.
28 29 30 |
# File 'lib/schema-evolution-manager/connection_data.rb', line 28 def pgpass(password=nil) [@host, @port, @name, @user, password.to_s].join(":") end |