view_component_helper 0.4.5 → 0.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57701718d039ac056f76dc09a6ad26114b495067fcbf6af07b9b0ffd30f3fbaf
4
- data.tar.gz: 9686baee018175896e73771ba436427183d8bba00e976441608e912e88515b4d
3
+ metadata.gz: 10a71a7f76a97313e83592765258db61e924f0fbbbce53e3809794c9f91cacaa
4
+ data.tar.gz: 5711f1eb3b405d2936c3a1365a12096c25e518b24df60ba7d944a85be4ef313f
5
5
  SHA512:
6
- metadata.gz: 9d765d480b9be81327db65955ffc028f2bd021bf66484344626e1d823690b92023dcbfcbb2834f463bf743ab9077dcf25d02700706872f0b62ecdd58cdb31a42
7
- data.tar.gz: 50a5cf227fbff3fb388e83e8c960df0ec52b7d616d7855a1433d6eb4fbd4246de5fbf6f65cbe19b194a32cb42dfb7dbe73ccea68d9d2072b55c1f69684a9b32a
6
+ metadata.gz: d360c889b42c61214786d9c8f6f9a7f2e17e610aef8750c64bcd22fa46fa7b59f3e02aa4ba379c96074b36df4de066515c44941f4bf134642f656ff7034b3fc6
7
+ data.tar.gz: 54cc3a3298c3e4e4910f9b4c94d72fd15cfaa062b891a8c902ce62cfd296082dddc600f70916b04a77b809628504b35ead357510ddc70f3d19e96757419c854b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- view_component_helper (0.4.5)
4
+ view_component_helper (0.9.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViewComponentHelper
4
- VERSION = "0.4.5"
4
+ VERSION = "0.9.0"
5
5
  end
@@ -7,6 +7,8 @@
7
7
  # and displaying components based on their file paths and additional arguments.
8
8
  #
9
9
  module ViewComponentHelper
10
+ require "active_support/core_ext/string/inflections"
11
+
10
12
  def render_view_component(path, *args, collection: nil, **kwargs, &block)
11
13
  component_klass = path.classify.constantize
12
14
 
@@ -20,13 +22,9 @@ module ViewComponentHelper
20
22
  alias render_vc render_view_component
21
23
  alias vc render_view_component
22
24
 
23
- def self.default_component_loader
24
- -> { Dir[Rails.root.join("app/components/**/*.rb")] }
25
- end
26
-
27
- def self.load_components(component_loader = default_component_loader)
25
+ def self.load_components(component_loader = -> { Dir[Rails.root.join("app/components/**/*.rb")] })
28
26
  component_loader.call.each do |file|
29
- component_path = extract_component_path(file)
27
+ component_path = file[%r{components/(.*)\.rb$}, 1]
30
28
  component_class_name = component_path.camelize
31
29
  method_name = component_path.gsub("/", "_")
32
30
 
@@ -34,10 +32,6 @@ module ViewComponentHelper
34
32
  end
35
33
  end
36
34
 
37
- def self.extract_component_path(file)
38
- file.gsub("#{Rails.root.join("app/components")}/", "").gsub(".rb", "")
39
- end
40
-
41
35
  def self.valid_component_class?(component_class_name)
42
36
  Object.const_defined?(component_class_name) && component_class_name.constantize < ViewComponent::Base
43
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_component_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yamitake
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-21 00:00:00.000000000 Z
11
+ date: 2023-09-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Simplify integration and boost productivity. '
14
14
  email: