Commit 1c5deb09 by Shu Fujita Committed by Andrew W. Lee

Refactor AnnotateModels::Helpers (#723)

I refactored two methods in AnnotateModels::Helpers for readability.
parent 9a8db1b7
...@@ -15,14 +15,11 @@ module Annotate ...@@ -15,14 +15,11 @@ module Annotate
end end
def true?(val) def true?(val)
return false if val.blank? val.present? && Constants::TRUE_RE.match?(val)
return false unless val =~ Constants::TRUE_RE
true
end end
def fallback(*args) def fallback(*args)
args.detect { |arg| !arg.blank? } args.detect(&:present?)
end end
def reset_options(options) def reset_options(options)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment