X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Factivesupport%2Flib%2Factive_support%2Fcore_ext%2Frange%2Foverlaps.rb;fp=vendor%2Frails%2Factivesupport%2Flib%2Factive_support%2Fcore_ext%2Frange%2Foverlaps.rb;h=43c69453e73dcacf72ad8719230b951ebfb2e33d;hb=d115f2e23823271635bad69229a42cd8ac68debe;hp=0000000000000000000000000000000000000000;hpb=37cb670bf3ddde90b214e591f100ed4446469484;p=depot.git 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 index 0000000..43c6945 --- /dev/null +++ b/vendor/rails/activesupport/lib/active_support/core_ext/range/overlaps.rb @@ -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