Class: Avm::Oracle::ConnectionStringBuilder
- Inherits:
-
Object
- Object
- Avm::Oracle::ConnectionStringBuilder
- Defined in:
- lib/avm/oracle/connection_string_builder.rb
Constant Summary collapse
- DEFAULT_PORT =
1521
- FIELDS =
%w[user password host port service_name].freeze
Instance Attribute Summary collapse
-
#string ⇒ Object
Returns the value of attribute string.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(options = nil) ⇒ ConnectionStringBuilder
constructor
A new instance of ConnectionStringBuilder.
- #port ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ ConnectionStringBuilder
Returns a new instance of ConnectionStringBuilder.
13 14 15 16 17 18 19 20 21 |
# File 'lib/avm/oracle/connection_string_builder.rb', line 13 def initialize( = nil) if .is_a?(String) self.string = elsif .is_a?(Hash) .each do |k, v| send("#{k}=", v) end end end |
Instance Attribute Details
#string ⇒ Object
Returns the value of attribute string.
11 12 13 |
# File 'lib/avm/oracle/connection_string_builder.rb', line 11 def string @string end |
Instance Method Details
#build ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/avm/oracle/connection_string_builder.rb', line 27 def build if string string else validate_fields "#{user}/#{password}@//#{host}:#{port}/#{service_name}" end end |
#port ⇒ Object
23 24 25 |
# File 'lib/avm/oracle/connection_string_builder.rb', line 23 def port @port || DEFAULT_PORT end |