Skip to content

Commit a6ab1ee

Browse files
committed
standardrb --fix
1 parent 4e59348 commit a6ab1ee

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

Rakefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ namespace :docs do
6969
.get("ViewComponent::Base")
7070
.meths
7171
.select do |method|
72-
!method.tag(:private) &&
73-
method.path.include?("ViewComponent::Base") &&
74-
method.visibility == :public &&
75-
!method[:name].to_s.start_with?("_") # Ignore methods we mark as internal by prefixing with underscores
72+
!method.tag(:private) &&
73+
method.path.include?("ViewComponent::Base") &&
74+
method.visibility == :public &&
75+
!method[:name].to_s.start_with?("_") # Ignore methods we mark as internal by prefixing with underscores
7676
end.sort_by { |method| method[:name] }
7777

7878
instance_methods_to_document = meths.select { |method| method.scope != :class }
@@ -83,8 +83,8 @@ namespace :docs do
8383
.meths
8484
.sort_by { |method| method[:name] }
8585
.select do |method|
86-
!method.tag(:private) &&
87-
method.visibility == :public
86+
!method.tag(:private) &&
87+
method.visibility == :public
8888
end
8989

9090
require "rails"

lib/view_component/base.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ def inherited(child)
577577
# eager loading is disabled and the parent component is rendered before the child. In
578578
# such a scenario, the parent will override ViewComponent::Base#render_template_for,
579579
# meaning it will not be called for any children and thus not compile their templates.
580-
if !child.instance_methods(false).include?(:render_template_for) && !child.__vc_compiled?
580+
if !child.method_defined?(:render_template_for, false) && !child.__vc_compiled?
581581
child.class_eval <<~RUBY, __FILE__, __LINE__ + 1
582582
def render_template_for(requested_details)
583583
# Force compilation here so the compiler always redefines render_template_for.
@@ -600,7 +600,7 @@ def render_template_for(requested_details)
600600
# Set collection parameter to the extended component
601601
child.with_collection_parameter(__vc_provided_collection_parameter)
602602

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

606606
vc_ancestor_calls.unshift(instance_method(:render_template_for))

lib/view_component/compiler.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ def template_errors
115115
.tally
116116
.select { |_, count| count > 1 }
117117
.each do |tally|
118-
variant, this_format = tally.first
118+
variant, this_format = tally.first
119119

120-
variant_string = " for variant `#{variant}`" if variant.present?
120+
variant_string = " for variant `#{variant}`" if variant.present?
121121

122-
errors << "More than one #{this_format.upcase} template found#{variant_string} for #{@component}. "
122+
errors << "More than one #{this_format.upcase} template found#{variant_string} for #{@component}. "
123123
end
124124

125125
default_template_types = @templates.each_with_object(Set.new) do |template, memo|
@@ -190,11 +190,11 @@ def gather_templates
190190
).flat_map { |ancestor| ancestor.instance_methods(false).grep(/^call(_|$)/) }
191191
.uniq
192192
.each do |method_name|
193-
templates << Template::InlineCall.new(
194-
component: @component,
195-
method_name: method_name,
196-
defined_on_self: component_instance_methods_on_self.include?(method_name)
197-
)
193+
templates << Template::InlineCall.new(
194+
component: @component,
195+
method_name: method_name,
196+
defined_on_self: component_instance_methods_on_self.include?(method_name)
197+
)
198198
end
199199

200200
templates

lib/view_component/slotable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def __vc_register_polymorphic_slot(slot_name, types, collection:)
259259

260260
setter_method_name = :"with_#{poly_slot_name}"
261261

262-
if instance_methods.include?(setter_method_name)
262+
if method_defined?(setter_method_name)
263263
raise AlreadyDefinedPolymorphicSlotSetterError.new(setter_method_name, poly_slot_name)
264264
end
265265

0 commit comments

Comments
 (0)