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
1 changed files with 7 additions and 4 deletions

View File

@ -35,10 +35,13 @@ 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)
case enumerable.first
when Numeric, Time, DateTime
:cover?
if enumerable.is_a? Range
case enumerable.first
when Numeric, Time, DateTime
:cover?
else
:include?
end
else
:include?
end