aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorVasiliy Ermolovich <younash@gmail.com>2011-12-26 23:07:27 +0300
committerVasiliy Ermolovich <younash@gmail.com>2011-12-26 23:07:27 +0300
commit3f642c9d1834a4ef586461648acc7c849bebad70 (patch)
tree43bd04e5bee55d39496a374918c74908de74b268 /activesupport
parentbec7cf2d1f600ba141b42de917a7c51f3b565308 (diff)
downloadrails-3f642c9d1834a4ef586461648acc7c849bebad70.tar.gz
rails-3f642c9d1834a4ef586461648acc7c849bebad70.tar.bz2
rails-3f642c9d1834a4ef586461648acc7c849bebad70.zip
refactor Range#include? for range value
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/range/include_range.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/range/include_range.rb b/activesupport/lib/active_support/core_ext/range/include_range.rb
index 0246627467..c9986d4724 100644
--- a/activesupport/lib/active_support/core_ext/range/include_range.rb
+++ b/activesupport/lib/active_support/core_ext/range/include_range.rb
@@ -9,9 +9,7 @@ class Range
# (5..9).include?(11) # => false
def include_with_range?(value)
if value.is_a?(::Range)
- operator = exclude_end? ? :< : :<=
- end_value = value.exclude_end? ? last.succ : last
- include_without_range?(value.first) && (value.last <=> end_value).send(operator, 0)
+ min <= value.min && max >= value.max
else
include_without_range?(value)
end