diff options
author | Sergey Nartimov <just.lest@gmail.com> | 2011-12-29 10:50:15 +0300 |
---|---|---|
committer | Sergey Nartimov <just.lest@gmail.com> | 2011-12-29 13:26:52 +0300 |
commit | 952e9d9005b775827b17227e040499d0324bb928 (patch) | |
tree | 41d1b45445e18cbaa17ea554038e568920b15df5 /activesupport/lib | |
parent | afd9512c0b4ff98f3fec2ff9fd78d430b2ace974 (diff) | |
download | rails-952e9d9005b775827b17227e040499d0324bb928.tar.gz rails-952e9d9005b775827b17227e040499d0324bb928.tar.bz2 rails-952e9d9005b775827b17227e040499d0324bb928.zip |
refactor Range#include? to handle ranges with floats
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/range/include_range.rb | 3 |
1 files changed, 2 insertions, 1 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 c9986d4724..38a90490e6 100644 --- a/activesupport/lib/active_support/core_ext/range/include_range.rb +++ b/activesupport/lib/active_support/core_ext/range/include_range.rb @@ -9,7 +9,8 @@ class Range # (5..9).include?(11) # => false def include_with_range?(value) if value.is_a?(::Range) - min <= value.min && max >= value.max + operator = exclude_end? && !value.exclude_end? ? :< : :<= + include_without_range?(value.first) && value.last.send(operator, last) else include_without_range?(value) end |