diff options
author | Xavier Noria <fxn@hashref.com> | 2011-12-30 02:18:07 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-12-30 02:25:00 -0800 |
commit | 0814e745b777f6eae000d098b127f4f0a9f6cb20 (patch) | |
tree | ce0d42c4728f0aa3f5edd9c3d956d90af4a9ccc9 /activesupport/lib/active_support/core_ext/range/include_range.rb | |
parent | 71f59b72fec12834645d9cc0d6dc61f15dcfde68 (diff) | |
download | rails-0814e745b777f6eae000d098b127f4f0a9f6cb20.tar.gz rails-0814e745b777f6eae000d098b127f4f0a9f6cb20.tar.bz2 rails-0814e745b777f6eae000d098b127f4f0a9f6cb20.zip |
adds a comments that clarifies why Range#include? chooses the comparison operator
Diffstat (limited to 'activesupport/lib/active_support/core_ext/range/include_range.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/range/include_range.rb | 1 |
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 |