jquery-rails-cdn 1.1.0 → 1.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74f2fc075f341160c003b22d6ac144273772eed7
4
- data.tar.gz: e301f983738623f8847385d6dd8d3967960f31ee
3
+ metadata.gz: c8e888e45dfe3fb34ae2ff6a2070241e25f09a5e
4
+ data.tar.gz: b7659e994085b1026ffe224d250c8287cae04460
5
5
  SHA512:
6
- metadata.gz: 801acf82ee8c3ddee109a8f63da786c9d4dedee74e0371f4e4a32614a46bae4b4871564e95382ec55c2262e8f1425c4306a1ad5cd179f532020b3fd46d6bca92
7
- data.tar.gz: 6816ed13a68305e82d94651b5635d7f8367eb24ade9878169dd1e639c9a4fcc11665d8d06018ef274c4c2aab8ea9c755a9a6305779f3ddc367c9a29f85cd84ca
6
+ metadata.gz: 5f0613d6eb3e943abd0162d5abf0c42db0383cd2a02401d3f95ce804e814f2fab62786e5936fd8e9f2b866315becaec1e4f176aad64e953bfd22190a3bda383a
7
+ data.tar.gz: 6301ba7e1b0b24d9a8a847020339fbcc640065c4674a46d5e6eb81d2396812f40287c0df3c138475a4cd3772254829a7f8d34dde91498ae1b9cbaf5e8a465d92
@@ -16,24 +16,32 @@ module Jquery::Rails::Cdn
16
16
 
17
17
  def jquery_url(name)
18
18
  @@jquery_urls ||= begin
19
- version = case Jquery::Rails::Cdn.major_version
20
- when 1, NilClass
21
- Jquery::Rails::JQUERY_VERSION
22
- when 2
23
- Jquery::Rails::JQUERY_2_VERSION
24
- else
25
- raise 'invalid :major_version option'
26
- end
19
+ version = jquery_version_chooser(Jquery::Rails::JQUERY_VERSION, Jquery::Rails::JQUERY_2_VERSION)
27
20
  Hash[URL.map{|k,v| [k, v.sub(/\{JQUERY_VERSION\}/, version)] }]
28
21
  end
29
- @@jquery_urls[name]
22
+ if name == :local
23
+ jquery_version_chooser(:jquery, :jquery2)
24
+ else
25
+ @@jquery_urls[name]
26
+ end
27
+ end
28
+
29
+ def jquery_version_chooser(one, two)
30
+ case Jquery::Rails::Cdn.major_version
31
+ when 1, NilClass
32
+ one
33
+ when 2
34
+ two
35
+ else
36
+ raise 'invalid :major_version option'
37
+ end
30
38
  end
31
39
 
32
40
  def jquery_include_tag(name, options = {})
33
- return javascript_include_tag(:jquery, options) if OFFLINE && !options.delete(:force)
41
+ return javascript_include_tag(jquery_url(:local), options) if OFFLINE && !options.delete(:force)
34
42
 
35
43
  [ javascript_include_tag(jquery_url(name), options),
36
- javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag(:jquery, options).gsub('<','%3C')}'))")
44
+ javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag(jquery_url(:local), options).gsub('<','%3C')}'))")
37
45
  ].join("\n").html_safe
38
46
  end
39
47
  end
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Rails
3
3
  module Cdn
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-rails-cdn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenn Ejima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-03 00:00:00.000000000 Z
11
+ date: 2015-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails