diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-26 12:23:36 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-26 12:23:36 -0800 |
commit | 28b008bae3c572ded0a76cea8766c1e1eeab5e71 (patch) | |
tree | f4eec41618d9168e0c446b317b8a0f5f1686389f /activesupport/lib | |
parent | 160f07fe8f28bb09b0889fe8dbc7faa947eaa450 (diff) | |
parent | 3f642c9d1834a4ef586461648acc7c849bebad70 (diff) | |
download | rails-28b008bae3c572ded0a76cea8766c1e1eeab5e71.tar.gz rails-28b008bae3c572ded0a76cea8766c1e1eeab5e71.tar.bz2 rails-28b008bae3c572ded0a76cea8766c1e1eeab5e71.zip |
Merge pull request #4197 from nashby/refactor-range-include
refactor Range#include? for range value
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/range/include_range.rb | 4 |
1 files changed, 1 insertions, 3 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 0246627467..c9986d4724 100644 --- a/activesupport/lib/active_support/core_ext/range/include_range.rb +++ b/activesupport/lib/active_support/core_ext/range/include_range.rb @@ -9,9 +9,7 @@ class Range # (5..9).include?(11) # => false def include_with_range?(value) if value.is_a?(::Range) - operator = exclude_end? ? :< : :<= - end_value = value.exclude_end? ? last.succ : last - include_without_range?(value.first) && (value.last <=> end_value).send(operator, 0) + min <= value.min && max >= value.max else include_without_range?(value) end |