activerecord_url_connections 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,22 @@
1
1
  require "active_record"
2
2
  module ActiveRecordURLConnections
3
3
  def self.parse(str)
4
- config = URI.parse(str)
5
- adapter = config.scheme
6
- adapter = "postgresql" if adapter == "postgres"
7
- spec = { :adapter => adapter,
8
- :username => config.user,
9
- :password => config.password,
10
- :port => config.port,
11
- :database => config.path.sub(%r{^/},""),
12
- :host => config.host }
13
- spec.reject!{ |key,value| value.nil? }
14
- spec.merge!(split_query_options(config.query))
15
- spec
4
+ if str =~ %r{//}
5
+ config = URI.parse(str)
6
+ adapter = config.scheme
7
+ adapter = "postgresql" if adapter == "postgres"
8
+ spec = { :adapter => adapter,
9
+ :username => config.user,
10
+ :password => config.password,
11
+ :port => config.port,
12
+ :database => config.path.sub(%r{^/},""),
13
+ :host => config.host }
14
+ spec.reject!{ |key,value| value.nil? }
15
+ spec.merge!(split_query_options(config.query))
16
+ spec
17
+ else
18
+ str
19
+ end
16
20
  rescue URI::InvalidURIError
17
21
  return nil
18
22
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordURLConnections
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_url_connections
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &70200263670480 !ruby/object:Gem::Requirement
16
+ requirement: &70252201956400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70200263670480
24
+ version_requirements: *70252201956400
25
25
  description: Allows database connections to be defined as URLS, then converted to
26
26
  hash for use in ActiveRecord
27
27
  email:
@@ -52,7 +52,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
52
  version: '0'
53
53
  segments:
54
54
  - 0
55
- hash: -4592356007819432443
55
+ hash: -4363979214670006784
56
56
  required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  version: '0'
62
62
  segments:
63
63
  - 0
64
- hash: -4592356007819432443
64
+ hash: -4363979214670006784
65
65
  requirements: []
66
66
  rubyforge_project: activerecord_url_connections
67
67
  rubygems_version: 1.8.15