metamagic 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/metamagic/helper_methods.rb +23 -5
- metadata +10 -7
@@ -7,15 +7,33 @@ module Metamagic
|
|
7
7
|
def metamagic(options = {})
|
8
8
|
options = @meta_tags || options
|
9
9
|
|
10
|
-
out =
|
10
|
+
out = []
|
11
11
|
options.each do |key, value|
|
12
|
-
if
|
13
|
-
|
12
|
+
if key.to_s == "title"
|
13
|
+
out << content_tag(:title, value)
|
14
|
+
else
|
15
|
+
props = { :name => key.to_s }
|
16
|
+
|
17
|
+
if value.is_a?(Hash)
|
18
|
+
props.merge! value
|
19
|
+
else
|
20
|
+
props[:content] = value
|
21
|
+
end
|
22
|
+
|
23
|
+
# loop through each property to find
|
24
|
+
# arrays that need to be joined
|
25
|
+
props.each_pair do |propkey, propvalue|
|
26
|
+
if propvalue.is_a?(Array)
|
27
|
+
propvalue = propvalue.join(", ")
|
28
|
+
end
|
29
|
+
props[propkey] = propvalue
|
30
|
+
end
|
31
|
+
|
32
|
+
out << tag("meta", props) if value
|
14
33
|
end
|
15
|
-
out += tag('meta', :name => key.to_s, :content => value) if value
|
16
34
|
end
|
17
35
|
|
18
|
-
out.html_safe
|
36
|
+
out.join.html_safe
|
19
37
|
end
|
20
38
|
end
|
21
39
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metamagic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Lasse Bunk
|
@@ -14,8 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
18
|
+
date: 2012-05-27 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: Metamagic is a simple Ruby on Rails plugin for creating meta tags.
|
@@ -29,7 +29,6 @@ extra_rdoc_files: []
|
|
29
29
|
files:
|
30
30
|
- lib/metamagic/helper_methods.rb
|
31
31
|
- lib/metamagic.rb
|
32
|
-
has_rdoc: true
|
33
32
|
homepage: http://github.com/lassebunk/metamagic
|
34
33
|
licenses: []
|
35
34
|
|
@@ -39,23 +38,27 @@ rdoc_options: []
|
|
39
38
|
require_paths:
|
40
39
|
- lib
|
41
40
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
42
|
requirements:
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
45
46
|
segments:
|
46
47
|
- 0
|
47
48
|
version: "0"
|
48
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
49
51
|
requirements:
|
50
52
|
- - ">="
|
51
53
|
- !ruby/object:Gem::Version
|
54
|
+
hash: 3
|
52
55
|
segments:
|
53
56
|
- 0
|
54
57
|
version: "0"
|
55
58
|
requirements: []
|
56
59
|
|
57
60
|
rubyforge_project:
|
58
|
-
rubygems_version: 1.
|
61
|
+
rubygems_version: 1.8.21
|
59
62
|
signing_key:
|
60
63
|
specification_version: 3
|
61
64
|
summary: Simple Ruby on Rails plugin for creating meta tags.
|