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 Attribute Summary collapse
-
#string ⇒ Object
Returns the value of attribute string.
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.
14 15 16 17 18 19 20 21 22 |
# File 'lib/avmtrf1/oracle/connection/string_builder.rb', line 14 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.
12 13 14 |
# File 'lib/avmtrf1/oracle/connection/string_builder.rb', line 12 def string @string end |
Instance Method Details
#build ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/avmtrf1/oracle/connection/string_builder.rb', line 28 def build if string string else validate_fields "#{user}/#{password}@//#{host}:#{port}/#{service_name}" end end |
#port ⇒ Object
24 25 26 |
# File 'lib/avmtrf1/oracle/connection/string_builder.rb', line 24 def port @port || DEFAULT_PORT end |