Sha256: 32f3da5b77870c8007dcf8893e00ce5adbab12130bb1f21a567cb25a459d6549

Contents?: true

Size: 258 Bytes

Versions: 156

Compression:

Stored size: 258 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)
    cover?(other.first) || other.cover?(first)
  end
end

Version data entries

156 entries across 145 versions & 17 rubygems

Version Path
activesupport-6.1.7.10 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7.9 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7.8 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7.7 lib/active_support/core_ext/range/overlaps.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activesupport-7.0.2.3/lib/active_support/core_ext/range/overlaps.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7.6 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7.5 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7.4 lib/active_support/core_ext/range/overlaps.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/overlaps.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activesupport-7.0.2.3/lib/active_support/core_ext/range/overlaps.rb
mumukit-content-type-1.12.1 vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/core_ext/range/overlaps.rb
mumukit-content-type-1.12.0 vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7.3 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7.2 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7.1 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.0.6.1 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.7 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.0.6 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.6.1 lib/active_support/core_ext/range/overlaps.rb