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:
parent
374d465f28
commit
aa7fdfb859
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue