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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc3f38e0c12dafc80bf6c2c9b74d09d3a3f019ee4d4a9dfa59d1a638a1228898
4
- data.tar.gz: 48f1df9b4f54a0049b96e37b1ca16de5125ef13163838aa94cba4fb5cb6f8a1f
3
+ metadata.gz: 66521e84077cac73f9c94df1323b7b7eefc168c47fa635a10ea92ca18ed2791b
4
+ data.tar.gz: 21add4be61c4e1dddb543704355b4263f5b87a7f8d9060d8c48f309d78703ed2
5
5
  SHA512:
6
- metadata.gz: 7efa511f6cc6b76fed913823eb54d3ec709e3d8ca99adbcbc6cf6a667c407be4885701b68fc174fa2af3908d6da708c77c9cffa58de23f3f11307510e7cceb57
7
- data.tar.gz: 238f0fd897c7125652cf80df6c59dcaa5d8bf5a1eb39d994a48a876be49cf0c43d5274eed3b2fbcf8915461ef1334dec9f92835b886e152e7eb64ab320b7049f
6
+ metadata.gz: 532230cb3c84dfd7d492b9f6ee1278dd2706b8c052a667c9be76467cf227616cbc90a69de7c675338ac3a46149b8b241a79668d6d7d399d1d3d7f52cd4251251
7
+ data.tar.gz: 4a3f0f2a7a4dabb25738e48ddbe92a704e2117e02ab1b38fbccc4c33913cc57115c4bc81e78c57647d5a2ca94843b0f9d79d64b559b0fd1c297fef2f56425194
@@ -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
- *Richard Macklin*
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).
@@ -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 instance_method(:initialize).parameters.map(&:last).include?(parameter)
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
@@ -3,7 +3,7 @@
3
3
  module ViewComponent
4
4
  module VERSION
5
5
  MAJOR = 2
6
- MINOR = 9
6
+ MINOR = 10
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.9.0
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-12 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport