dynamic_assets 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,7 +69,7 @@ protected
69
69
  host.call(source)
70
70
  end
71
71
  else
72
- (host =~ /%d/) ? host % (source.hash % 4) : host
72
+ (host =~ /%d/) ? host % hash_url(source) : host
73
73
  end
74
74
  end
75
75
  end
@@ -86,4 +86,18 @@ protected
86
86
  [options, path_options]
87
87
  end
88
88
 
89
+ # Don't use String#hash because it differs across VM invocations,
90
+ # meaning different servers will map the same URL to different asset
91
+ # hosts.
92
+ def hash_url(url)
93
+ l = url.length
94
+ i = 0
95
+ h = l
96
+ while i < l
97
+ h = h ^ url[i].ord
98
+ i = i + 1
99
+ end
100
+ h % 4
101
+ end
102
+
89
103
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dynamic_assets
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.7.4
5
+ version: 0.7.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Robert Davis
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-26 00:00:00 -05:00
13
+ date: 2011-06-30 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -128,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
- hash: -4117142351372619099
131
+ hash: -1933479551771191958
132
132
  segments:
133
133
  - 0
134
134
  version: "0"