Sha256: 035fe6ba4d4e3e4ee514d7468bde9ad7ee71764ccf3e26e60e5a654d92f8de16

Contents?: true

Size: 292 Bytes

Versions: 33

Compression:

Stored size: 292 Bytes

Contents

# frozen_string_literal: true

class Range
  # Compare two ranges and see if they overlap each other
  #  (1..5).overlaps?(4..6) # => true
  #  (1..5).overlaps?(7..9) # => false
  def overlaps?(other)
    other.begin == self.begin || cover?(other.begin) || other.cover?(self.begin)
  end
end

Version data entries

33 entries across 32 versions & 8 rubygems

Version Path
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/core_ext/range/overlaps.rb
fablicop-1.10.2 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5/lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.5 lib/active_support/core_ext/range/overlaps.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/activesupport-7.0.4.3/lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.4.3 lib/active_support/core_ext/range/overlaps.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.4.2 lib/active_support/core_ext/range/overlaps.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.4.1 lib/active_support/core_ext/range/overlaps.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.4 lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.3.1 lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.3 lib/active_support/core_ext/range/overlaps.rb