view_component 2.64.0 → 2.65.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of view_component might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cee1c1b53cec5fec9d4613416a27999c653c2cf8fb176798b235c7b71dc795d
4
- data.tar.gz: 5fb8a364788849fecfb8bb2160ebd6dc403f624ba6b3fe13c818706f928b8257
3
+ metadata.gz: db3da8b9e69982d34a963e91a36a872b8c09a83526b142e51c0cf9548c0d704e
4
+ data.tar.gz: 305ea910ad67535dd4769d3c570bb11a3ef37aea09118174b0861ec7089ee234
5
5
  SHA512:
6
- metadata.gz: d721f8d07af64e314a506afc364941f95d3b824d27e587e12d8c774f4fa168b7ae00ac400c4f73b546ed0d5728aec60d586e52dacaee2b8f10e01230bbe3ab8f
7
- data.tar.gz: 598ab2f08524a8eb10b17a001ed7429223ca39ab204c25cec4375ea201e3afa1c852ba1578f81a1de5c83211e1eb05f3c1a7d146f83cc1d77e3f4ed0bfdef962
6
+ metadata.gz: 842babf3fd5a9c1e15c803e2605e6e4891b08c0766948f1e5a0e72bdaaf0b129a8b26959684adb8be257d295681ef241e3c828651a72e1badda342382cfca662
7
+ data.tar.gz: 920553b0b73da80802fb940821fb454cf7587063d7df89630f4fb9425c123b38cfc5e3e49b912022a556a8207f6ca8e6e47662d86056dbf603c548eb9197dee2
data/docs/CHANGELOG.md CHANGED
@@ -9,6 +9,21 @@ title: Changelog
9
9
 
10
10
  ## main
11
11
 
12
+ ## 2.65.0
13
+
14
+ * Raise `ArgumentError` when conflicting Slots are defined.
15
+
16
+ Before this change it was possible to define Slots with conflicting names, for example:
17
+
18
+ ```ruby
19
+ class MyComponent < ViewComponent::Base
20
+ renders_one :item
21
+ renders_many :items
22
+ end
23
+ ```
24
+
25
+ *Joel Hawksley*
26
+
12
27
  ## 2.64.0
13
28
 
14
29
  * Add `warn_on_deprecated_slot_setter` flag to opt-in to deprecation warning.
@@ -80,6 +80,7 @@ module ViewComponent
80
80
  # <% end %>
81
81
  def renders_one(slot_name, callable = nil)
82
82
  validate_singular_slot_name(slot_name)
83
+ validate_plural_slot_name(ActiveSupport::Inflector.pluralize(slot_name).to_sym)
83
84
 
84
85
  define_method :"with_#{slot_name}" do |*args, &block|
85
86
  set_slot(slot_name, nil, *args, &block)
@@ -147,9 +148,9 @@ module ViewComponent
147
148
  # <% end %>
148
149
  # <% end %>
149
150
  def renders_many(slot_name, callable = nil)
150
- validate_plural_slot_name(slot_name)
151
-
152
151
  singular_name = ActiveSupport::Inflector.singularize(slot_name)
152
+ validate_plural_slot_name(slot_name)
153
+ validate_singular_slot_name(ActiveSupport::Inflector.singularize(slot_name).to_sym)
153
154
 
154
155
  # Define setter for singular names
155
156
  # for example `renders_many :items` allows fetching all tabs with
@@ -3,7 +3,7 @@
3
3
  module ViewComponent
4
4
  module VERSION
5
5
  MAJOR = 2
6
- MINOR = 64
6
+ MINOR = 65
7
7
  PATCH = 0
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
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.64.0
4
+ version: 2.65.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-03 00:00:00.000000000 Z
11
+ date: 2022-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport