Skip to content
Browse files

Remove short circuit return in favor of simple conditional

  • Loading branch information...
1 parent 374d465 commit aa7fdfb859d8a73f58460a7aba7174a47b5101d5 @carlosantoniodasilva carlosantoniodasilva committed
Showing with 7 additions and 4 deletions.
  1. +7 −4 activemodel/lib/active_model/validations/clusivity.rb
11 activemodel/lib/active_model/validations/clusivity.rb
@@ -35,10 +35,13 @@ def delimiter
# <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

0 comments on commit aa7fdfb

Please sign in to comment.
Something went wrong with that request. Please try again.