diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-21 04:30:28 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-21 04:39:53 -0700 |
commit | baf73e19a6f05fcb46c06d759b08f3cbe22ed1c9 (patch) | |
tree | 9d3b1e3cac3c123163baefd3658f6a79a260182a /activesupport/lib | |
parent | b8d59b7f845b6de8b4359900f228efc13e7d1ee5 (diff) | |
download | rails-baf73e19a6f05fcb46c06d759b08f3cbe22ed1c9.tar.gz rails-baf73e19a6f05fcb46c06d759b08f3cbe22ed1c9.tar.bz2 rails-baf73e19a6f05fcb46c06d759b08f3cbe22ed1c9.zip |
Convert Range extension module to a class reopen
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/range.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/range/overlaps.rb | 19 |
2 files changed, 9 insertions, 14 deletions
diff --git a/activesupport/lib/active_support/core_ext/range.rb b/activesupport/lib/active_support/core_ext/range.rb index 0253239748..638fba0c6b 100644 --- a/activesupport/lib/active_support/core_ext/range.rb +++ b/activesupport/lib/active_support/core_ext/range.rb @@ -1,2 +1,4 @@ +require 'active_support/core_ext/range/overlaps' + require 'active_support/core_ext/util' -ActiveSupport.core_ext Range, %w(conversions overlaps include_range blockless_step) +ActiveSupport.core_ext Range, %w(conversions include_range blockless_step) diff --git a/activesupport/lib/active_support/core_ext/range/overlaps.rb b/activesupport/lib/active_support/core_ext/range/overlaps.rb index 43c69453e7..0dec6e0ac4 100644 --- a/activesupport/lib/active_support/core_ext/range/overlaps.rb +++ b/activesupport/lib/active_support/core_ext/range/overlaps.rb @@ -1,15 +1,8 @@ -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 +class Range + # 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 |