diff --git a/Gemfile.lock b/Gemfile.lock index b4a9a7922..984b4e9bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -285,7 +285,7 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.5) - rubocop (1.75.8) + rubocop (1.80.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -293,7 +293,7 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.44.0, < 2.0) + rubocop-ast (>= 1.46.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.47.1) @@ -339,10 +339,10 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - standard (1.50.0) + standard (1.51.1) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.75.5) + rubocop (~> 1.80.2) standard-custom (~> 1.0.0) standard-performance (~> 1.8) standard-custom (1.0.2) diff --git a/lib/generators/view_component/component/component_generator.rb b/lib/generators/view_component/component/component_generator.rb index 0cce03808..60964c285 100644 --- a/lib/generators/view_component/component/component_generator.rb +++ b/lib/generators/view_component/component/component_generator.rb @@ -23,7 +23,7 @@ class ComponentGenerator < Rails::Generators::NamedBase class_option :skip_suffix, type: :boolean, default: false def create_component_file - template "component.rb", File.join(component_path, class_path, "#{file_name}#{options[:skip_suffix] ? "" : "_component"}.rb") + template "component.rb", File.join(component_path, class_path, "#{file_name}#{"_component" unless options[:skip_suffix]}.rb") end hook_for :test_framework diff --git a/lib/view_component/collection.rb b/lib/view_component/collection.rb index b76eeea1a..c53f1f1af 100644 --- a/lib/view_component/collection.rb +++ b/lib/view_component/collection.rb @@ -5,6 +5,7 @@ module ViewComponent class Collection include Enumerable + attr_reader :component delegate :size, to: :@collection diff --git a/lib/view_component/inline_template.rb b/lib/view_component/inline_template.rb index 06152e99b..95bb2acac 100644 --- a/lib/view_component/inline_template.rb +++ b/lib/view_component/inline_template.rb @@ -3,6 +3,7 @@ module ViewComponent # :nodoc: module InlineTemplate extend ActiveSupport::Concern + Template = Struct.new(:source, :language, :path, :lineno) class_methods do