aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-11-15 01:11:57 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-11-15 01:11:57 -0200
commitaa7fdfb859d8a73f58460a7aba7174a47b5101d5 (patch)
tree8b31a6bb4435dab76a1f6d3b82929d6fd2375d03 /activemodel/lib
parent374d465f2894dc5b120cc6a5f28619a6e60407be (diff)
downloadrails-aa7fdfb859d8a73f58460a7aba7174a47b5101d5.tar.gz
rails-aa7fdfb859d8a73f58460a7aba7174a47b5101d5.tar.bz2
rails-aa7fdfb859d8a73f58460a7aba7174a47b5101d5.zip
Remove short circuit return in favor of simple conditional
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/validations/clusivity.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/activemodel/lib/active_model/validations/clusivity.rb b/activemodel/lib/active_model/validations/clusivity.rb
index fd6cc1edb4..bad9e4f9a9 100644
--- a/activemodel/lib/active_model/validations/clusivity.rb
+++ b/activemodel/lib/active_model/validations/clusivity.rb
@@ -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