From 3f642c9d1834a4ef586461648acc7c849bebad70 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Mon, 26 Dec 2011 23:07:27 +0300 Subject: refactor Range#include? for range value --- activesupport/lib/active_support/core_ext/range/include_range.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activesupport') 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 -- cgit v1.2.3