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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3785bc6edacf42b58b3da6a84e82067f9c740ac8
4
- data.tar.gz: 45c1275787928af7cf48adbc35e4035c55d0558f
3
+ metadata.gz: db6eed70ef80714dd6ce2abf2734aeabe71337b6
4
+ data.tar.gz: 017a7abdbc84eabd2ebab6a16bb52334ea072707
5
5
  SHA512:
6
- metadata.gz: 4b15f67940db99c9a8a637094df1d87f85ae088d7f8a9c613ec095f636b813d8137a70d535ada796518301c2d2d2a41c12fe38698f8761a4ac8d63056a53f36d
7
- data.tar.gz: 8f4bb4af01686c7adce5374216ebb9322c62ea7d31696962c8b22b3bf76e304b4802f6d6fdd9fa87d77b09135692183a5adcaaa759c86ea735190653c135c1a9
6
+ metadata.gz: 86b5bea5a74acfc5c5eed5b997a86d1d31bb2404736cfdc35a889f585b4b8e9ae5eb8b08c633540361df41d520f87f051cd334a7587537486fcfdadd9c2f14cd
7
+ data.tar.gz: 9399b18fe4a280bf6102244ad6fe5d37b2f618de6570082ccf8749c8e62532346c4d51a135dfccd2af6f3eab9c27894444de6a70e4fc2f1bd992618ac3bdaa7d
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 3.1.3
4
+
5
+ # Shortcut helpers now return the value you send to them.
6
+
3
7
  ## Version 3.1.2
4
8
 
5
9
  * Add HTML safety handling.
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
@@ -1,3 +1,3 @@
1
1
  module Metamagic
2
- VERSION = "3.1.2"
2
+ VERSION = "3.1.3"
3
3
  end
@@ -23,7 +23,9 @@ module Metamagic
23
23
 
24
24
  def method_missing(method, *args, &block)
25
25
  if metamagic_renderer.has_tag_type?(method)
26
- meta method => args.first
26
+ args.first.tap do |value|
27
+ meta method => value
28
+ end
27
29
  else
28
30
  super
29
31
  end
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metamagic
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Bunk