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.0.4.5 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.4.5 lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.2.1 lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.2 lib/active_support/core_ext/range/overlaps.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/range/overlaps.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/range/overlaps.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.1 lib/active_support/core_ext/range/overlaps.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.0 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.4.4 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.0.4.4 lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.0.rc3 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.4.3 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.0.4.3 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.0.4.2 lib/active_support/core_ext/range/overlaps.rb
activesupport-6.1.4.2 lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.0.rc2 lib/active_support/core_ext/range/overlaps.rb
activesupport-7.0.0.rc1 lib/active_support/core_ext/range/overlaps.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/core_ext/range/overlaps.rb