rails_default_url_options 1.5.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,29 +28,22 @@
28
28
 
29
29
  unless defined?(DefaultUrlOptions)
30
30
 
31
- DefaultUrlOptions = (
32
- begin
33
- require 'map'
34
- Map.new
35
- rescue
36
- Hash.new
37
- end
38
- )
31
+ DefaultUrlOptions = Hash.new
39
32
 
40
33
  def DefaultUrlOptions.version
41
- '1.5.0'
34
+ '2.0.0'
42
35
  end
43
36
 
44
37
  def DefaultUrlOptions.dependencies
45
- {
46
- 'map' => [ 'map' , ' >= 6.0.0' ] ,
47
- }
38
+ {}
48
39
  end
49
40
 
50
41
 
51
42
  def DefaultUrlOptions.configure(request = {})
52
43
  default_url_options = DefaultUrlOptions
53
44
 
45
+ default_url_options.clear
46
+
54
47
  if request.is_a?(Hash)
55
48
  protocol = request[:protocol] || request['protocol']
56
49
  host = request[:host] || request['host']
@@ -75,6 +68,11 @@ unless defined?(DefaultUrlOptions)
75
68
  end
76
69
 
77
70
  default_url_options
71
+ ensure
72
+ keys.each do |key|
73
+ next if key.is_a?(Symbol)
74
+ self[key.to_s.to_sym] = self.fetch(key)
75
+ end
78
76
  end
79
77
 
80
78
  def DefaultUrlOptions.configure!(request = {})
@@ -117,10 +115,6 @@ unless defined?(DefaultUrlOptions)
117
115
  delete(:port) if port.to_s == '80'
118
116
  end
119
117
 
120
- if host.to_s =~ /^www\./
121
- self[:host] = host.to_s.gsub(/^www\./, '')
122
- end
123
-
124
118
  keys.each{|key| delete(key) if self[key].nil?}
125
119
 
126
120
  self
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "rails_default_url_options"
6
- spec.version = "1.5.0"
6
+ spec.version = "2.0.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rails_default_url_options"
9
9
  spec.description = "description: rails_default_url_options kicks the ass"
@@ -22,8 +22,6 @@ Gem::Specification::new do |spec|
22
22
  spec.test_files = nil
23
23
 
24
24
 
25
- spec.add_dependency(*["map", " >= 6.0.0"])
26
-
27
25
 
28
26
  spec.extensions.push(*[])
29
27
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_default_url_options
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-26 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: map
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 6.0.0
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 6.0.0
12
+ date: 2013-04-10 00:00:00.000000000 Z
13
+ dependencies: []
30
14
  description: ! 'description: rails_default_url_options kicks the ass'
31
15
  email: ara.t.howard@gmail.com
32
16
  executables: []
@@ -62,3 +46,4 @@ signing_key:
62
46
  specification_version: 3
63
47
  summary: rails_default_url_options
64
48
  test_files: []
49
+ has_rdoc: