aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-12-30 02:18:07 -0800
committerXavier Noria <fxn@hashref.com>2011-12-30 02:18:07 -0800
commit9fa59ca2083c6a8d06af1fbca6059821516102fd (patch)
tree9572c92342a796f11ed2e9364f1866561e6c89a8
parentedfe7d80135465858bda841b0bc5991f14f35295 (diff)
downloadrails-9fa59ca2083c6a8d06af1fbca6059821516102fd.tar.gz
rails-9fa59ca2083c6a8d06af1fbca6059821516102fd.tar.bz2
rails-9fa59ca2083c6a8d06af1fbca6059821516102fd.zip
adds a comments that clarifies why Range#include? chooses the comparison operator
-rw-r--r--activesupport/lib/active_support/core_ext/range/include_range.rb1
1 files changed, 1 insertions, 0 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 38a90490e6..684b7cbc4a 100644
--- a/activesupport/lib/active_support/core_ext/range/include_range.rb
+++ b/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