Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ GEM
racc (~> 1.4)
nokogiri (1.19.4-x86_64-linux-musl)
racc (~> 1.4)
parallel (1.27.0)
parser (3.3.10.1)
parallel (1.28.0)
parser (3.3.11.1)
ast (~> 2.4.1)
racc
pp (0.6.3)
Expand Down Expand Up @@ -284,7 +284,7 @@ GEM
redis-client (>= 0.22.0)
redis-client (0.26.4)
connection_pool
regexp_parser (2.11.3)
regexp_parser (2.12.0)
reline (0.6.3)
io-console (~> 0.5)
rexml (3.4.4)
Expand All @@ -305,18 +305,18 @@ GEM
rspec-mocks (>= 3.13.0, < 5.0.0)
rspec-support (>= 3.13.0, < 5.0.0)
rspec-support (3.13.7)
rubocop (1.84.2)
rubocop (1.87.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parallel (>= 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.0)
rubocop-ast (1.49.1)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-md (2.0.4)
Expand Down Expand Up @@ -357,10 +357,10 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
standard (1.54.0)
standard (1.55.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.84.0)
rubocop (~> 1.87.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.8)
standard-custom (1.0.2)
Expand Down Expand Up @@ -545,8 +545,8 @@ CHECKSUMS
nokogiri (1.19.4-x86_64-darwin) sha256=7fd17057d3e1f00e9954a74b3cd76595d3d4a5ef233b7ed9599047c204f70551
nokogiri (1.19.4-x86_64-linux-gnu) sha256=379fae440b28915e3f19d752ce2dcf8465ed2b2fbefd2a7ca0dd497bc981a06a
nokogiri (1.19.4-x86_64-linux-musl) sha256=17dfb7c1fa194ae02fbf7c51a7afc8d278045ab3fdacfd86f91d02d7b274470b
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970
parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54
pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
Expand All @@ -569,16 +569,16 @@ CHECKSUMS
reactionview (0.3.0) sha256=3bd363863776827eaf85a9baf75370c1ca52a4b0dad87ba5d672e4abe76eb640
redis (5.4.1) sha256=b5e675b57ad22b15c9bcc765d5ac26f60b675408af916d31527af9bd5a81faae
redis-client (0.26.4) sha256=3ad70beff5da2653e02dfeae996e7d8d7147a558da12b16b2282ad345e4c7120
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
rspec-rails (8.0.4) sha256=06235692fc0892683d3d34977e081db867434b3a24ae0dd0c6f3516bad4e22df
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
rubocop (1.87.0) sha256=b9d9ddf55116a513f8ef2c7ae660662d8b49301f118d3f0df61865b33a5c188d
rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
rubocop-md (2.0.4) sha256=0d076b6b5e99dea2ddc928c4bd702497decb9a8400da7808091e02ebcafcfb93
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
Expand All @@ -593,7 +593,7 @@ CHECKSUMS
smart_properties (1.17.0) sha256=f9323f8122e932341756ddec8e0ac9ec6e238408a7661508be99439ca6d6384b
sprockets (4.2.2) sha256=761e5a49f1c288704763f73139763564c845a8f856d52fba013458f8af1b59b1
sprockets-rails (3.5.2) sha256=a9e88e6ce9f8c912d349aa5401509165ec42326baf9e942a85de4b76dbc4119e
standard (1.54.0) sha256=7a4b08f83d9893083c8f03bc486f0feeb6a84d48233b40829c03ef4767ea0100
standard (1.55.0) sha256=8a8f2c3e681a4db3aafde1b301561b0f3d7c5f06c160167cb744a4d7baf0426e
standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b
standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
Expand Down
12 changes: 6 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ namespace :docs do
.get("ViewComponent::Base")
.meths
.select do |method|
!method.tag(:private) &&
method.path.include?("ViewComponent::Base") &&
method.visibility == :public &&
!method[:name].to_s.start_with?("_") # Ignore methods we mark as internal by prefixing with underscores
!method.tag(:private) &&
method.path.include?("ViewComponent::Base") &&
method.visibility == :public &&
!method[:name].to_s.start_with?("_") # Ignore methods we mark as internal by prefixing with underscores
end.sort_by { |method| method[:name] }

instance_methods_to_document = meths.select { |method| method.scope != :class }
Expand All @@ -83,8 +83,8 @@ namespace :docs do
.meths
.sort_by { |method| method[:name] }
.select do |method|
!method.tag(:private) &&
method.visibility == :public
!method.tag(:private) &&
method.visibility == :public
end

require "rails"
Expand Down
2 changes: 1 addition & 1 deletion lib/docs/docs_builder_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module ViewComponent
class DocsBuilderComponent < Base
class Section < Struct.new(:heading, :methods, :error_klasses, :show_types, keyword_init: true)
class Section < Struct.new(:heading, :methods, :error_klasses, :show_types)
def initialize(heading: nil, methods: [], error_klasses: [], show_types: true)
methods.sort_by! { |method| method[:name] }
error_klasses.sort!
Expand Down
16 changes: 8 additions & 8 deletions lib/view_component/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ def template_errors
.tally
.select { |_, count| count > 1 }
.each do |tally|
variant, this_format = tally.first
variant, this_format = tally.first

variant_string = " for variant `#{variant}`" if variant.present?
variant_string = " for variant `#{variant}`" if variant.present?

errors << "More than one #{this_format.upcase} template found#{variant_string} for #{@component}. "
errors << "More than one #{this_format.upcase} template found#{variant_string} for #{@component}. "
end

default_template_types = @templates.each_with_object(Set.new) do |template, memo|
Expand Down Expand Up @@ -190,11 +190,11 @@ def gather_templates
).flat_map { |ancestor| ancestor.instance_methods(false).grep(/^call(_|$)/) }
.uniq
.each do |method_name|
templates << Template::InlineCall.new(
component: @component,
method_name: method_name,
defined_on_self: component_instance_methods_on_self.include?(method_name)
)
templates << Template::InlineCall.new(
component: @component,
method_name: method_name,
defined_on_self: component_instance_methods_on_self.include?(method_name)
)
end

templates
Expand Down
2 changes: 1 addition & 1 deletion lib/view_component/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Template
DEFAULT_FORMAT = :html
private_constant :DEFAULT_FORMAT

DataWithSource = Struct.new(:format, :identifier, :short_identifier, :type, keyword_init: true)
DataWithSource = Struct.new(:format, :identifier, :short_identifier, :type)

attr_reader :details, :path

Expand Down
2 changes: 1 addition & 1 deletion test/sandbox/app/models/coupon.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Coupon = Struct.new(:percent_off, keyword_init: true)
Coupon = Struct.new(:percent_off)
2 changes: 1 addition & 1 deletion test/sandbox/app/models/partial_model.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PartialModel = Struct.new(:to_partial_path, keyword_init: true)
PartialModel = Struct.new(:to_partial_path)
2 changes: 1 addition & 1 deletion test/sandbox/app/models/photo.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Photo = Struct.new(:title, :caption, :url, keyword_init: true)
Photo = Struct.new(:title, :caption, :url)
2 changes: 1 addition & 1 deletion test/sandbox/app/models/product.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Product = Struct.new(:name, keyword_init: true)
Product = Struct.new(:name)
Loading