From 0814e745b777f6eae000d098b127f4f0a9f6cb20 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Fri, 30 Dec 2011 02:18:07 -0800 Subject: adds a comments that clarifies why Range#include? chooses the comparison operator --- activesupport/lib/active_support/core_ext/range/include_range.rb | 1 + 1 file changed, 1 insertion(+) 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 -- cgit v1.2.3