Class: Avmtrf1::Oracle::Connection::StringBuilder
- Inherits:
-
Object
- Object
- Avmtrf1::Oracle::Connection::StringBuilder
- Defined in:
- lib/avmtrf1/oracle/connection/string_builder.rb
Constant Summary collapse
- DEFAULT_PORT =
1521
- FIELDS =
%w[user password host port service_name].freeze
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(options = nil) ⇒ StringBuilder
constructor
A new instance of StringBuilder.
- #port ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ StringBuilder
Returns a new instance of StringBuilder.
13 14 15 16 17 18 19 20 21 |
# File 'lib/avmtrf1/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 Method Details
#build ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/avmtrf1/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/avmtrf1/oracle/connection/string_builder.rb', line 23 def port @port || DEFAULT_PORT end |