sugar 0.0.35 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.35
1
+ 0.0.36
@@ -7,14 +7,14 @@ module Sugar
7
7
  noscript_includes = []
8
8
  initializers = []
9
9
 
10
- if options[:piwik]
11
- static_includes << "//#{options[:piwik][:site]}/piwik.js"
12
- initializers <<-END_PIWIK
13
- var piwikTracker = Piwik.getTracker("#{options[:piwik][:site]}/piwik.php", #{options[:piwik][:id]});
10
+ if piwik = options.delete(:piwik)
11
+ static_includes << "//#{piwik[:site]}/piwik.js"
12
+ initializers = %{
13
+ var piwikTracker = Piwik.getTracker("#{piwik[:site]}/piwik.php", #{piwik[:id]});
14
14
  piwikTracker.trackPageView();
15
15
  piwikTracker.enableLinkTracking();
16
- END_PIWIK
17
- noscript_includes << %(<img src="//#{options[:piwik][:site]}/piwik.php?idsite=#{options[:piwik][:id]}" alt="" style="border:0" />)
16
+ }
17
+ noscript_includes << %[<img src="//#{piwik[:site]}/piwik.php?idsite=#{piwik[:id]}" alt="" style="border:0" />]
18
18
  end
19
19
 
20
20
  if options[:metrika]
@@ -29,17 +29,17 @@ module Sugar
29
29
  initializers << "var pageTracker = _gat._getTracker('#{options}'); pageTracker._trackPageview();"
30
30
  end
31
31
 
32
- returning '' do |result|
32
+ returning('') do |result|
33
33
  unless dynamic_includes.empty?
34
34
  result << javascript_tag(dynamic_includes)
35
35
  end
36
36
  result << javascript_include_tag(static_includes) unless static_includes.empty?
37
37
  unless initializers.empty?
38
- result << javascript_tag do
39
- initializers.collect do |initializer|
40
- "try {#{initializer}} catch(e) {}\n"
41
- end
42
- end
38
+ initializers = initializers.inject('') do |pack, initializer|
39
+ pack << "try {#{initializer}} catch(e) {}"
40
+ pack
41
+ end.join("\n")
42
+ result << javascript_tag(initializers)
43
43
  end
44
44
  unless noscript_includes.empty?
45
45
  result << content_tag(:noscript,
@@ -49,7 +49,6 @@ module Sugar
49
49
  end
50
50
  end
51
51
  end
52
-
53
52
  end
54
53
  end
55
54
  end
data/sugar.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sugar}
8
- s.version = "0.0.35"
8
+ s.version = "0.0.36"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alexander Semyonov"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35
4
+ version: 0.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Semyonov