1 module ActiveSupport #:nodoc:
2 module CoreExtensions #:nodoc:
4 # Check if a Range includes another Range.
6 def self.included(base) #:nodoc:
7 base.alias_method_chain :include?, :range
10 def include_with_range?(value)
11 if value.is_a?(::Range)
12 operator = exclude_end? ? :< : :<=
13 end_value = value.exclude_end? ? last.succ : last
14 include?(value.first) && (value.last <=> end_value).send(operator, 0)
16 include_without_range?(value)