Permalink
Browse files

adds a comments that clarifies why Range#include? chooses the compari…

…son operator
  • Loading branch information...
1 parent edfe7d8 commit 9fa59ca2083c6a8d06af1fbca6059821516102fd @fxn fxn committed Dec 30, 2011
Showing with 1 addition and 0 deletions.
  1. +1 −0 activesupport/lib/active_support/core_ext/range/include_range.rb
@@ -9,6 +9,7 @@ class Range
# (5..9).include?(11) # => false
def include_with_range?(value)
if value.is_a?(::Range)
+ # 1...10 includes 1..9 but it does not include 1..10.
operator = exclude_end? && !value.exclude_end? ? :< : :<=
include_without_range?(value.first) && value.last.send(operator, last)
else

0 comments on commit 9fa59ca

Please sign in to comment.