view_component 2.76.0 → 2.77.0
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.
Potentially problematic release.
This version of view_component might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +6 -0
- data/lib/view_component/compiler.rb +19 -2
- data/lib/view_component/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb24cfba68b7323e80beee43cfb7a676ddc833bc87d63201d953d16301defe5d
|
4
|
+
data.tar.gz: 40599c33c49d1dcaa29ae1ec0b6b9e93f191735c2e28207d88717f3f9c77a561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6dd24af9a10eae0a9fc81c18570fe410686bad3db5cbb9840ee0f52038185eff956c64d260b9231d75226ae7e06a7fcdcafcbc4c37214917bf7155b64d2dc59
|
7
|
+
data.tar.gz: 863f21e3be9102ddc02b6a20a7c804b4b1490c7714fbbf2ea848b79a3b5da6cec960afa28fe7bb752e882da6cb4df89a4db67a7d462dfaaf40261b8b2bbf64d1
|
data/docs/CHANGELOG.md
CHANGED
@@ -92,7 +92,7 @@ module ViewComponent
|
|
92
92
|
|
93
93
|
def define_render_template_for
|
94
94
|
variant_elsifs = variants.compact.uniq.map do |variant|
|
95
|
-
"elsif variant.to_sym ==
|
95
|
+
"elsif variant.to_sym == :'#{variant}'\n #{call_method_name(variant)}"
|
96
96
|
end.join("\n")
|
97
97
|
|
98
98
|
body = <<-RUBY
|
@@ -163,6 +163,19 @@ module ViewComponent
|
|
163
163
|
"There can only be a template file or inline render method per variant."
|
164
164
|
end
|
165
165
|
|
166
|
+
uniq_variants = variants.compact.uniq
|
167
|
+
normalized_variants = uniq_variants.map { |variant| normalized_variant_name(variant) }
|
168
|
+
|
169
|
+
colliding_variants = uniq_variants.select do |variant|
|
170
|
+
normalized_variants.count(normalized_variant_name(variant)) > 1
|
171
|
+
end
|
172
|
+
|
173
|
+
unless colliding_variants.empty?
|
174
|
+
errors <<
|
175
|
+
"Colliding templates #{colliding_variants.sort.map { |v| "'#{v}'" }.to_sentence} " \
|
176
|
+
"found in #{component_class}."
|
177
|
+
end
|
178
|
+
|
166
179
|
errors
|
167
180
|
end
|
168
181
|
end
|
@@ -234,12 +247,16 @@ module ViewComponent
|
|
234
247
|
|
235
248
|
def call_method_name(variant)
|
236
249
|
if variant.present? && variants.include?(variant)
|
237
|
-
"call_#{variant}"
|
250
|
+
"call_#{normalized_variant_name(variant)}"
|
238
251
|
else
|
239
252
|
"call"
|
240
253
|
end
|
241
254
|
end
|
242
255
|
|
256
|
+
def normalized_variant_name(variant)
|
257
|
+
variant.to_s.gsub("-", "__")
|
258
|
+
end
|
259
|
+
|
243
260
|
def should_compile_superclass?
|
244
261
|
development? &&
|
245
262
|
templates.empty? &&
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.77.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ViewComponent Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|