~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/activesupport/lib/active_support/core_ext/range/overlaps.rb

  • Committer: Richard Lee (Canonical)
  • Date: 2010-10-15 15:17:58 UTC
  • mfrom: (190.1.3 use-case-mapper)
  • Revision ID: richard.lee@canonical.com-20101015151758-wcvmfxrexsongf9d
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
module ActiveSupport #:nodoc:
2
 
  module CoreExtensions #:nodoc:
3
 
    module Range #:nodoc:
4
 
      # Check if Ranges overlap.
5
 
      module Overlaps
6
 
        # Compare two ranges and see if they overlap eachother
7
 
        #  (1..5).overlaps?(4..6) # => true
8
 
        #  (1..5).overlaps?(7..9) # => false
9
 
        def overlaps?(other)
10
 
          include?(other.first) || other.include?(first)
11
 
        end
12
 
      end
13
 
    end
14
 
  end
15
 
end