Skip to content
Merged

Fix ci #2532

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
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ GEM
websocket-driver (~> 0.7)
globalid (1.3.0)
activesupport (>= 6.1)
haml (7.1.0)
haml (7.2.0)
temple (>= 0.8.2)
thor
tilt
Expand Down Expand Up @@ -211,13 +211,13 @@ GEM
nokogiri (1.19.0-x86_64-linux-musl)
racc (~> 1.4)
parallel (1.27.0)
parser (3.3.10.0)
parser (3.3.10.1)
ast (~> 2.4.1)
racc
pp (0.6.3)
prettyprint
prettyprint (0.2.0)
prism (1.7.0)
prism (1.8.0)
propshaft (1.3.1)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
Expand Down Expand Up @@ -269,7 +269,7 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.3.1)
rdoc (7.0.3)
rdoc (7.1.0)
erb
psych (>= 4.0.0)
tsort
Expand Down Expand Up @@ -301,15 +301,15 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.6)
rubocop (1.81.7)
rubocop (1.82.1)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.47.1, < 2.0)
rubocop-ast (>= 1.48.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.0)
Expand Down Expand Up @@ -353,10 +353,10 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
standard (1.52.0)
standard (1.53.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.81.7)
rubocop (~> 1.82.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.8)
standard-custom (1.0.2)
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
4 changes: 2 additions & 2 deletions lib/view_component/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def inherited(child)
# eager loading is disabled and the parent component is rendered before the child. In
# such a scenario, the parent will override ViewComponent::Base#render_template_for,
# meaning it will not be called for any children and thus not compile their templates.
if !child.instance_methods(false).include?(:render_template_for) && !child.__vc_compiled?
if !child.method_defined?(:render_template_for, false) && !child.__vc_compiled?
child.class_eval <<~RUBY, __FILE__, __LINE__ + 1
def render_template_for(requested_details)
# Force compilation here so the compiler always redefines render_template_for.
Expand All @@ -600,7 +600,7 @@ def render_template_for(requested_details)
# Set collection parameter to the extended component
child.with_collection_parameter(__vc_provided_collection_parameter)

if instance_methods(false).include?(:render_template_for)
if method_defined?(:render_template_for, false)
vc_ancestor_calls = defined?(@__vc_ancestor_calls) ? @__vc_ancestor_calls.dup : []

vc_ancestor_calls.unshift(instance_method(:render_template_for))
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/slotable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def __vc_register_polymorphic_slot(slot_name, types, collection:)

setter_method_name = :"with_#{poly_slot_name}"

if instance_methods.include?(setter_method_name)
if method_defined?(setter_method_name)
raise AlreadyDefinedPolymorphicSlotSetterError.new(setter_method_name, poly_slot_name)
end

Expand Down
Loading