From e3985d6285b73b9f79a22abe405836e610e27fa2 Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Thu, 22 Feb 2024 20:43:18 -0500 Subject: [PATCH] reduce host#verbose_supports? calls to supports? now it only calls supports?() once (via unsupported_reason) rather than twice before. Besides that, it is the same --- app/models/host.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/models/host.rb b/app/models/host.rb index ec79162eac26..eb1da4b64649 100644 --- a/app/models/host.rb +++ b/app/models/host.rb @@ -1432,11 +1432,10 @@ def self.display_name(number = 1) end def verbose_supports?(feature, description = nil) - supports?(feature).tap do |value| - unless value - description ||= feature.to_s.humanize(:capitalize => false) - _log.warn("Cannot #{description} because <#{unsupported_reason(feature)}>") - end + if (reason = unsupported_reason(feature)) + description ||= feature.to_s.humanize(:capitalize => false) + _log.warn("Cannot #{description} because <#{reason}>") end + !reason end end