From aeb51b04545e115f96b730b9c2f87ff1c10b5c5b Mon Sep 17 00:00:00 2001 From: Joel Hawksley Date: Tue, 10 Sep 2024 14:00:13 -0600 Subject: [PATCH] use any? with method extracted to template --- lib/view_component/compiler.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/view_component/compiler.rb b/lib/view_component/compiler.rb index da557c39e..2dc2eda8c 100644 --- a/lib/view_component/compiler.rb +++ b/lib/view_component/compiler.rb @@ -26,7 +26,7 @@ def compile(raise_errors: false, force: false) gather_templates - if self.class.development_mode && @templates.none? { !(_1.inline_call? && !_1.defined_on_self?) } + if self.class.development_mode && @templates.any?(&:requires_compiled_superclass?) @component.superclass.compile(raise_errors: raise_errors) end @@ -259,6 +259,10 @@ def #{@call_method_name} @component.define_method(safe_method_name, @component.instance_method(@call_method_name)) end + def requires_compiled_superclass? + inline_call? && !defined_on_self? + end + def inline_call? @type == :inline_call end