metamagic 3.1.2 → 3.1.3
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +8 -0
- data/lib/metamagic/version.rb +1 -1
- data/lib/metamagic/view_helper.rb +3 -1
- data/test/metamagic_test.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db6eed70ef80714dd6ce2abf2734aeabe71337b6
|
4
|
+
data.tar.gz: 017a7abdbc84eabd2ebab6a16bb52334ea072707
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86b5bea5a74acfc5c5eed5b997a86d1d31bb2404736cfdc35a889f585b4b8e9ae5eb8b08c633540361df41d520f87f051cd334a7587537486fcfdadd9c2f14cd
|
7
|
+
data.tar.gz: 9399b18fe4a280bf6102244ad6fe5d37b2f618de6570082ccf8749c8e62532346c4d51a135dfccd2af6f3eab9c27894444de6a70e4fc2f1bd992618ac3bdaa7d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -184,6 +184,14 @@ This will generate the following:
|
|
184
184
|
</head>
|
185
185
|
```
|
186
186
|
|
187
|
+
Shortcut helpers return the value you send to them, so you can dry up your code by setting the title once in e.g. a `<h1>` tag, like this:
|
188
|
+
|
189
|
+
```erb
|
190
|
+
<h1><%= title "My Title" %></h1>
|
191
|
+
```
|
192
|
+
|
193
|
+
This is the same as setting the title at the top of your view.
|
194
|
+
|
187
195
|
**Note:** Shortcut helpers will never override methods already present in the view context, so for example if you have a method named `title`, this will not be overridden.
|
188
196
|
|
189
197
|
### Specifying default meta tag values
|
data/lib/metamagic/version.rb
CHANGED
data/test/metamagic_test.rb
CHANGED
@@ -51,6 +51,12 @@ class MetamagicTest < ActionView::TestCase
|
|
51
51
|
metamagic
|
52
52
|
end
|
53
53
|
|
54
|
+
test "shortcut helper returns value" do
|
55
|
+
assert_equal "My Title", title("My Title")
|
56
|
+
assert_equal "My Description", description("My Description")
|
57
|
+
assert_equal %w{one two three}, keywords(%w{one two three})
|
58
|
+
end
|
59
|
+
|
54
60
|
test "not adding templates from views" do
|
55
61
|
title "This is a :nonexistent_key"
|
56
62
|
|