hanko 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e21fb6fc601ee5743a2575f6d134e6cd19f2de17
4
- data.tar.gz: 9b288a755a06e4c9ef0fe74583edd4911000685f
3
+ metadata.gz: d02cf787d3e42910046b22162ac3c795d19076ae
4
+ data.tar.gz: 6d9a548f1137b59a8b688041f1f7cae459244d01
5
5
  SHA512:
6
- metadata.gz: b00c59ad3f7d8f9ed8d7ba7d078f0bbf9c92fa2158506d1382198870df2b724a0cf839e551560e5e29b02ba653b11439808c2c2002713f87ed4972e312bd8036
7
- data.tar.gz: 61addcc281c758da50797731983288a5cb710b9e390536a576c4252fea9e5424b507fca920dafa63ecfd988598874da62d341c59e1eaff791c3de4285dfe09a8
6
+ metadata.gz: 57c54d64277e78d1b0133d75030c53560ab3a0620f5f613d6ff063a573a12b465cdf7ca72a1293c4016a06d37ebcfaba6e7498ea3b5a2302cac81180467f59ee
7
+ data.tar.gz: 4c147de0779df13b4ddc49cd7cb2201acfba31ca1661b3f3da27ce17f8f4aa059694efca7b5ed709d9e3fc55693dc63b6dc1fb5ea6eb75bd9f4f14c23ed82720
@@ -1,21 +1,23 @@
1
1
  module Hanko
2
2
  module AssetUrlHelper
3
- URI_REGEXP = ::ActionView::Helpers::AssetUrlHelper::URI_REGEXP
3
+ URI_REGEXP = %r{^(?:[-a-z]+://|cid:|data:|//)}i
4
4
 
5
5
  def asset_path(source, options = {})
6
6
  source = source.to_s
7
- return "" unless source.present?
8
- return source if source =~ URI_REGEXP
7
+ return "" if source.empty?
8
+ return source if URI_REGEXP === source
9
9
 
10
- tail, source = source[/([\?#].+)$/], source.sub(/([\?#].+)$/, '')
10
+ if index = source.index(/[?#]/)
11
+ source, tail = source[0, index], source[index..-1]
12
+ end
11
13
 
12
14
  if extname = compute_asset_extname(source, options)
13
15
  source = "#{source}#{extname}"
14
16
  end
15
17
 
16
18
  if source[0] != ?/
17
- # The patch is only here
18
- source = compute_asset_path(source, options.merge(fingerprint: tail.nil?))
19
+ options[:fingerprint] = !tail
20
+ source = compute_asset_path(source, options)
19
21
  end
20
22
 
21
23
  relative_url_root = defined?(config.relative_url_root) && config.relative_url_root
@@ -1,3 +1,3 @@
1
1
  module Hanko
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - tsukasaoishi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-20 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack