metamagic 3.1.5 → 3.1.6

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: 1ad1cfb51aa95e26223fc02287031c0e05541514
4
- data.tar.gz: 290dc71df03bd998dad9bd0fc5c1af19e6722b9b
3
+ metadata.gz: 57930b74a808316cefbeec3bbc64ef77b663fabb
4
+ data.tar.gz: c95622c22507fac0b58ce38d7621d552aea66711
5
5
  SHA512:
6
- metadata.gz: 2cac024a9c26e40f864b03b2fcfa3c5e6dea7b92e82a17321e4b2d50fb5f48cb13fe0fa4a0d755f55906fd893fb6ad1e93af1907b6a87da9ba9472c0c0c8070a
7
- data.tar.gz: c8c70d7029d85fd580c0d8d0ffa4f61b287a54b2a9961ccf8c11f6c456ecf1a1a8ee2faca1c5f61e4b9f9ce76269ca0a7b81dba28134f3243a7ce941843f9f45
6
+ metadata.gz: 0dd898c6711a29f723fac3f9863d36d494cb0d91eb79bfc8033d5d8063dc70a62f92e86c29f2a94c4728c4a61f55e7d078bc0a6c40b160b66f64360c9e397288
7
+ data.tar.gz: b245b1875056f118f934d9c119a41dc9df80d03c5dbb93d04d4f422868aa9f16706c67d862d236fa9b811374d7abae7e1c8044c267ba6ab2f535dcd86642c6f5
data/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 3.1.6
4
+
5
+ * Revert changes from 3.1.5 because of regression errors.
6
+
3
7
  ## Version 3.1.5
4
8
 
5
- * Adds support for duplicating tags, e.g. setting `twitter:image` to the value of `og:image`.
9
+ * Adds support for duplicating tags, e.g. setting `twitter:image` to the value of `og:image`. *(reverted in 3.1.6)*
6
10
 
7
11
  ## Version 3.1.4
8
12
 
data/README.md CHANGED
@@ -162,34 +162,6 @@ Templates are supported on all tag types. You can access the values set in the
162
162
  view by replacing colons (`:`) in your meta keys with underscores (`_`), so for
163
163
  example `og:image` can be accessed with `og_image`.
164
164
 
165
- ### Duplicating tags
166
-
167
- Sometimes you want tags to be the same for e.g. Twitter and Facebook (OpenGraph).
168
- To circumvent the need to duplicate these tags every time you write them in your code, you can let Metamagic do this for you.
169
-
170
- Given that you want to add the same tags for Twitter as you have for Facebook, you can do this, in your view:
171
-
172
- ```erb
173
- <%
174
- og title: "My Title",
175
- image: "http://test.com/image.jpg",
176
- description: "My description."
177
- %>
178
- ```
179
-
180
- And in your layout:
181
-
182
- ```erb
183
- <%= metamagic twitter: {
184
- card: "summary",
185
- title: :og_title,
186
- image: :og_image,
187
- description: :og_description
188
- }
189
- ```
190
-
191
- Now you only need to set OpenGraph data and these will be copied to Twitter.
192
-
193
165
  ### Shortcut helpers
194
166
 
195
167
  For easy setting of meta tags, you can use the shortcut helpers like this:
@@ -69,7 +69,7 @@ module Metamagic
69
69
  end
70
70
 
71
71
  def has_tag_type?(prefix)
72
- self.class.tag_types.has_key?(prefix.to_sym)
72
+ self.class.tag_types.has_key?(prefix)
73
73
  end
74
74
 
75
75
  def title_template
@@ -94,12 +94,8 @@ module Metamagic
94
94
  tags.sort.map(&:to_html).compact.join("\n").html_safe
95
95
  end
96
96
 
97
- def method_missing(method, *args, &block)
98
- if method.to_s =~ /^([^_]+)/ && has_tag_type?($1) # Adds support for calling e.g. `og_image`
99
- tags.find { |t| t.key == method.to_s.gsub("_", ":") }.try(:interpolated_values)
100
- else
101
- context.send(method, *args, &block)
102
- end
97
+ def method_missing(*args)
98
+ context.send(*args)
103
99
  end
104
100
 
105
101
  private
@@ -1,3 +1,3 @@
1
1
  module Metamagic
2
- VERSION = "3.1.5"
2
+ VERSION = "3.1.6"
3
3
  end
@@ -23,12 +23,8 @@ module Metamagic
23
23
 
24
24
  def method_missing(method, *args, &block)
25
25
  if metamagic_renderer.has_tag_type?(method)
26
- if args.length > 0
27
- value = args.first
26
+ args.first.tap do |value|
28
27
  meta method => value
29
- value
30
- else
31
- metamagic_renderer.send method
32
28
  end
33
29
  else
34
30
  super
@@ -82,12 +82,4 @@ class MetamagicTest < ActionView::TestCase
82
82
  assert_equal %{<title>My Title</title>\n<meta content="one, two, three" name="keywords" />\n<meta content="My description." name="description" />\n<meta content="http://test.com/image.png" property="og:image" />\n<meta content="summary" property="twitter:card" />},
83
83
  metamagic
84
84
  end
85
-
86
- test "duplicating tags" do
87
- og image: "http://test.com/image.png",
88
- description: "My description."
89
-
90
- assert_equal %{<meta content="http://test.com/image.png" property="og:image" />\n<meta content="http://test.com/default.png" property="og:image" />\n<meta content="My description." property="og:description" />\n<meta content="http://test.com/image.png" property="twitter:image" />\n<meta content="http://test.com/default.png" property="twitter:image" />\n<meta content="summary" property="twitter:card" />\n<meta content="My description." property="twitter:description" />},
91
- metamagic(og: { image: [:value, "http://test.com/default.png"] }, twitter: { card: "summary", image: :og_image, description: :og_description, other: :og_nonexisting })
92
- end
93
85
  end
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.5
4
+ version: 3.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Bunk