adsense_for_search 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/adsense_for_search.rb +15 -0
- data/lib/adsense_for_search/view_helper.rb +3 -3
- metadata +2 -6
data/lib/adsense_for_search.rb
CHANGED
@@ -7,3 +7,18 @@ end
|
|
7
7
|
|
8
8
|
ActionView::Base.send :include, AdSenseForSearch::ViewHelper
|
9
9
|
|
10
|
+
class Hash
|
11
|
+
def to_json2
|
12
|
+
result = []
|
13
|
+
|
14
|
+
each do |key, value|
|
15
|
+
string = "\"#{key}\":"
|
16
|
+
string << ((value.class.to_s == "String") ? "\"#{value}\"" : "#{value}")
|
17
|
+
|
18
|
+
result << string
|
19
|
+
end
|
20
|
+
|
21
|
+
"{#{result.join(',')}}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -37,9 +37,9 @@ module AdSenseForSearch
|
|
37
37
|
adblock2.merge! options.last[:adblock2] if options.last.has_key? :adblock2
|
38
38
|
|
39
39
|
js = ""
|
40
|
-
js << "var pageOptions = #{pageOptions.
|
41
|
-
js << "\n var adblock1 = #{adblock1.
|
42
|
-
js << "\n var adblock2 = #{adblock2.
|
40
|
+
js << "var pageOptions = #{pageOptions.to_json2};\n"
|
41
|
+
js << "\n var adblock1 = #{adblock1.to_json2};\n" if options.last.has_key? :adblock1
|
42
|
+
js << "\n var adblock2 = #{adblock2.to_json2};\n" if options.last.has_key? :adblock2
|
43
43
|
js << "\n new google.ads.search.Ads(pageOptions#{ ', adblock1' if options.last.has_key? :adblock1 }#{ ', adblock2' if options.last.has_key? :adblock2 });"
|
44
44
|
|
45
45
|
<<-javascript
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adsense_for_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 27
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Tiago Rafael Godinho
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
28
|
segments:
|
31
29
|
- 2
|
32
30
|
version: "2"
|
@@ -59,7 +57,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
57
|
requirements:
|
60
58
|
- - ">="
|
61
59
|
- !ruby/object:Gem::Version
|
62
|
-
hash: 3
|
63
60
|
segments:
|
64
61
|
- 0
|
65
62
|
version: "0"
|
@@ -68,7 +65,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
65
|
requirements:
|
69
66
|
- - ">="
|
70
67
|
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
68
|
segments:
|
73
69
|
- 0
|
74
70
|
version: "0"
|