Class: Txdb::ConnectionString

Inherits:
Object
  • Object
show all
Defined in:
lib/txdb/connection_string.rb

Constant Summary collapse

TEMPLATES =
{
  mysql2: "%{adapter}://%{username}:%{password}@%{host}:%{port}/%{name}",
  sqlite: "%{adapter}://%{name}"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ConnectionString

Returns a new instance of ConnectionString.



10
11
12
# File 'lib/txdb/connection_string.rb', line 10

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/txdb/connection_string.rb', line 8

def options
  @options
end

Instance Method Details

#stringObject



14
15
16
# File 'lib/txdb/connection_string.rb', line 14

def string
  TEMPLATES[options[:adapter].to_sym] % options
end