view_component 2.9.0 → 2.10.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 +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +6 -0
- data/lib/view_component/base.rb +14 -1
- 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: 66521e84077cac73f9c94df1323b7b7eefc168c47fa635a10ea92ca18ed2791b
|
4
|
+
data.tar.gz: 21add4be61c4e1dddb543704355b4263f5b87a7f8d9060d8c48f309d78703ed2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 532230cb3c84dfd7d492b9f6ee1278dd2706b8c052a667c9be76467cf227616cbc90a69de7c675338ac3a46149b8b241a79668d6d7d399d1d3d7f52cd4251251
|
7
|
+
data.tar.gz: 4a3f0f2a7a4dabb25738e48ddbe92a704e2117e02ab1b38fbccc4c33913cc57115c4bc81e78c57647d5a2ca94843b0f9d79d64b559b0fd1c297fef2f56425194
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# master
|
2
2
|
|
3
|
+
# 2.10.0
|
4
|
+
|
5
|
+
* Raise an `ArgumentError` with a helpful message when Ruby cannot parse a component class.
|
6
|
+
|
7
|
+
*Max Beizer*
|
8
|
+
|
3
9
|
# 2.9.0
|
4
10
|
|
5
11
|
* Cache components per-request in development, preventing unnecessary recompilation during a single request.
|
@@ -16,7 +22,7 @@
|
|
16
22
|
|
17
23
|
* Add `rendered_component` method to `ViewComponent::TestHelpers` which exposes the raw output of the rendered component.
|
18
24
|
|
19
|
-
|
25
|
+
*Richard Macklin*
|
20
26
|
|
21
27
|
* Support sidecar directories for views and other assets.
|
22
28
|
|
data/README.md
CHANGED
@@ -731,6 +731,7 @@ ViewComponent is far from a novel idea! Popular implementations of view componen
|
|
731
731
|
## Resources
|
732
732
|
|
733
733
|
- [Encapsulating Views, RailsConf 2020](https://youtu.be/YVYRus_2KZM)
|
734
|
+
- [Rethinking the View Layer with Components - Ruby Rogues Podcast](https://devchat.tv/ruby-rogues/rr-461-rethinking-the-view-layer-with-components-with-joel-hawksley/)
|
734
735
|
- [ViewComponent at GitHub with Joel Hawksley](https://the-ruby-blend.fireside.fm/9)
|
735
736
|
- [Components, HAML vs ERB, and Design Systems](https://the-ruby-blend.fireside.fm/4)
|
736
737
|
- [Choosing the Right Tech Stack with Dave Paola](https://5by5.tv/rubyonrails/307)
|
@@ -783,6 +784,11 @@ ViewComponent is built by:
|
|
783
784
|
|@simonrand|@fugufish|@cover|@franks921|@fsateler|
|
784
785
|
|Dublin, Ireland|Salt Lake City, Utah|Barcelona|South Africa|Chile|
|
785
786
|
|
787
|
+
|<img src="https://avatars.githubusercontent.com/maxbeizer?s=256" alt="maxbeizer" width="128" />|
|
788
|
+
|:---:|
|
789
|
+
|@maxbeizer|
|
790
|
+
|Nashville, TN|
|
791
|
+
|
786
792
|
## License
|
787
793
|
|
788
794
|
ViewComponent is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/lib/view_component/base.rb
CHANGED
@@ -307,7 +307,16 @@ module ViewComponent
|
|
307
307
|
parameter = validate_default ? collection_parameter : provided_collection_parameter
|
308
308
|
|
309
309
|
return unless parameter
|
310
|
-
return if
|
310
|
+
return if initialize_parameters.map(&:last).include?(parameter)
|
311
|
+
|
312
|
+
# If Ruby cannot parse the component class, then the initalize
|
313
|
+
# parameters will be empty and ViewComponent will not be able to render
|
314
|
+
# the component.
|
315
|
+
if initialize_parameters.empty?
|
316
|
+
raise ArgumentError.new(
|
317
|
+
"#{self} initializer is empty or invalid."
|
318
|
+
)
|
319
|
+
end
|
311
320
|
|
312
321
|
raise ArgumentError.new(
|
313
322
|
"#{self} initializer must accept " \
|
@@ -317,6 +326,10 @@ module ViewComponent
|
|
317
326
|
|
318
327
|
private
|
319
328
|
|
329
|
+
def initialize_parameters
|
330
|
+
instance_method(:initialize).parameters
|
331
|
+
end
|
332
|
+
|
320
333
|
def provided_collection_parameter
|
321
334
|
@provided_collection_parameter ||= nil
|
322
335
|
end
|
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.10.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: 2020-06-
|
11
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|