Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / core_ext / range / overlaps.rb
diff --git a/vendor/rails/activesupport/lib/active_support/core_ext/range/overlaps.rb b/vendor/rails/activesupport/lib/active_support/core_ext/range/overlaps.rb
new file mode 100644 (file)
index 0000000..43c6945
--- /dev/null
@@ -0,0 +1,15 @@
+module ActiveSupport #:nodoc:
+  module CoreExtensions #:nodoc:
+    module Range #:nodoc:
+      # Check if Ranges overlap.
+      module Overlaps
+        # Compare two ranges and see if they overlap eachother
+        #  (1..5).overlaps?(4..6) # => true
+        #  (1..5).overlaps?(7..9) # => false
+        def overlaps?(other)
+          include?(other.first) || other.include?(first)
+        end
+      end
+    end
+  end
+end