1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove short circuit return in favor of simple conditional

This commit is contained in:
Carlos Antonio da Silva 2013-11-15 01:11:57 -02:00
parent 374d465f28
commit aa7fdfb859

View file

@ -35,13 +35,16 @@ module ActiveModel
# <tt>Range#cover?</tt> uses the previous logic of comparing a value with the range
# endpoints, which is fast but is only accurate on Numeric, Time, or DateTime ranges.
def inclusion_method(enumerable)
return :include? unless enumerable.is_a?(Range)
if enumerable.is_a? Range
case enumerable.first
when Numeric, Time, DateTime
:cover?
else
:include?
end
else
:include?
end
end
end
end