From 7e5a026b535c3caa046a6470a51695a365cf8218 Mon Sep 17 00:00:00 2001 From: Shu Fujita Date: Sun, 19 Jan 2020 05:28:51 +0900 Subject: [PATCH] Refactor AnnotateModels::Helpers (#723) I refactored two methods in AnnotateModels::Helpers for readability. --- lib/annotate/helpers.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/annotate/helpers.rb b/lib/annotate/helpers.rb index fb44924e3..705685790 100644 --- a/lib/annotate/helpers.rb +++ b/lib/annotate/helpers.rb @@ -15,14 +15,11 @@ def include_models? end def true?(val) - return false if val.blank? - return false unless val =~ Constants::TRUE_RE - - true + val.present? && Constants::TRUE_RE.match?(val) end def fallback(*args) - args.detect { |arg| !arg.blank? } + args.detect(&:present?) end def reset_options(options)