Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4197 from nashby/refactor-range-include

refactor Range#include? for range value
  • Loading branch information...
commit 28b008bae3c572ded0a76cea8766c1e1eeab5e71 2 parents 160f07f + 3f642c9
@josevalim josevalim authored
View
4 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
Please sign in to comment.
Something went wrong with that request. Please try again.