Class: Sequelinha::ConnectionURL
- Inherits:
-
Object
- Object
- Sequelinha::ConnectionURL
show all
- Defined in:
- lib/sequelinha/connection_url.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ConnectionURL.
3
4
5
|
# File 'lib/sequelinha/connection_url.rb', line 3
def initialize(config)
@config = config
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
7
8
9
|
# File 'lib/sequelinha/connection_url.rb', line 7
def config
@config
end
|
Class Method Details
.=~(adapter) ⇒ Object
10
11
12
|
# File 'lib/sequelinha/connection_url.rb', line 10
def =~(adapter)
nil
end
|
Instance Method Details
#adapter ⇒ Object
27
28
29
|
# File 'lib/sequelinha/connection_url.rb', line 27
def adapter
@config["adapter"]
end
|
#application_root ⇒ Object
15
16
17
|
# File 'lib/sequelinha/connection_url.rb', line 15
def application_root
@config["application_root"]
end
|
#database ⇒ Object
31
32
33
|
# File 'lib/sequelinha/connection_url.rb', line 31
def database
@config["database"]
end
|
#host ⇒ Object
35
36
37
|
# File 'lib/sequelinha/connection_url.rb', line 35
def host
@config["host"] || "localhost"
end
|
#password ⇒ Object
23
24
25
|
# File 'lib/sequelinha/connection_url.rb', line 23
def password
@config["password"]
end
|
#string ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/sequelinha/connection_url.rb', line 39
def string
final_url = "#{self.adapter}://"
final_url << "#{self.username}:" if self.username
final_url << "#{self.password}" if self.password
final_url << "@#{self.host}" if self.host
final_url << "/#{self.database}" if self.database
end
|
#username ⇒ Object
19
20
21
|
# File 'lib/sequelinha/connection_url.rb', line 19
def username
@config["username"]
end
|