Skip to content

Commit

Permalink
use any? with method extracted to template
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhawksley committed Sep 10, 2024
1 parent 2b26f1b commit aeb51b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/view_component/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit aeb51b0

Please sign in to comment.