Sha256: 98c7e0d0ba7f0cf4141273fcc2f0cc28adf09ba8042e36ef3c62e8b8407f5a24

Contents?: true

Size: 645 Bytes

Versions: 21

Compression:

Stored size: 645 Bytes

Contents

module ActiveSupport #:nodoc:
  module CoreExtensions #:nodoc:
    module Range #:nodoc:
      # Check if a Range includes another Range.
      module IncludeRange
        def self.included(base) #:nodoc:
          base.alias_method_chain :include?, :range
        end

        def include_with_range?(value)
          if value.is_a?(::Range)
            operator = exclude_end? ? :< : :<=
            end_value = value.exclude_end? ? last.succ : last
            include?(value.first) && (value.last <=> end_value).send(operator, 0)
          else
            include_without_range?(value)
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 4 rubygems

Version Path
activesupport-2.0.0 lib/active_support/core_ext/range/include_range.rb
activesupport-2.0.1 lib/active_support/core_ext/range/include_range.rb
activesupport-2.0.2 lib/active_support/core_ext/range/include_range.rb
activesupport-2.0.5 lib/active_support/core_ext/range/include_range.rb
activesupport-2.0.4 lib/active_support/core_ext/range/include_range.rb
radiant-0.6.5.1 vendor/rails/activesupport/lib/active_support/core_ext/range/include_range.rb
radiant-0.6.5 vendor/rails/activesupport/lib/active_support/core_ext/range/include_range.rb
radiant-0.6.7 vendor/rails/activesupport/lib/active_support/core_ext/range/include_range.rb
radiant-0.6.6 vendor/rails/activesupport/lib/active_support/core_ext/range/include_range.rb
radiant-0.6.8 vendor/rails/activesupport/lib/active_support/core_ext/range/include_range.rb
radiant-0.6.9 vendor/rails/activesupport/lib/active_support/core_ext/range/include_range.rb
spree-0.0.9 vendor/rails/activesupport/lib/active_support/core_ext/range/include_range.rb
spree-0.2.0 vendor/rails/activesupport/lib/active_support/core_ext/range/include_range.rb
swivel-0.0.150 vendor/activesupport-2.0.2-/lib/active_support/core_ext/range/include_range.rb
swivel-0.0.149 vendor/activesupport-2.0.2-/lib/active_support/core_ext/range/include_range.rb
swivel-0.0.157 vendor/activesupport-2.0.2-/lib/active_support/core_ext/range/include_range.rb
swivel-0.0.156 vendor/activesupport-2.0.2-/lib/active_support/core_ext/range/include_range.rb
swivel-0.0.152 vendor/activesupport-2.0.2-/lib/active_support/core_ext/range/include_range.rb
swivel-0.0.160 vendor/activesupport-2.0.2-/lib/active_support/core_ext/range/include_range.rb
swivel-0.0.175 vendor/activesupport-2.0.2-/lib/active_support/core_ext/range/include_range.rb