aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/range
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/range')
-rw-r--r--activesupport/lib/active_support/core_ext/range/each.rb12
-rw-r--r--activesupport/lib/active_support/core_ext/range/include_range.rb8
2 files changed, 12 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/core_ext/range/each.rb b/activesupport/lib/active_support/core_ext/range/each.rb
index ecef78f55f..f666480fe6 100644
--- a/activesupport/lib/active_support/core_ext/range/each.rb
+++ b/activesupport/lib/active_support/core_ext/range/each.rb
@@ -1,18 +1,22 @@
-require 'active_support/core_ext/module/aliasing'
-
class Range #:nodoc:
def each_with_time_with_zone(&block)
ensure_iteration_allowed
each_without_time_with_zone(&block)
end
- alias_method_chain :each, :time_with_zone
+ # TODO: change to Module#prepend as soon as the fix is backported to MRI 2.2:
+ # https://bugs.ruby-lang.org/issues/10847
+ alias_method :each_without_time_with_zone, :each
+ alias_method :each, :each_with_time_with_zone
def step_with_time_with_zone(n = 1, &block)
ensure_iteration_allowed
step_without_time_with_zone(n, &block)
end
- alias_method_chain :step, :time_with_zone
+ # TODO: change to Module#prepend as soon as the fix is backported to MRI 2.2:
+ # https://bugs.ruby-lang.org/issues/10847
+ alias_method :step_without_time_with_zone, :step
+ alias_method :step, :step_with_time_with_zone
private
def ensure_iteration_allowed
diff --git a/activesupport/lib/active_support/core_ext/range/include_range.rb b/activesupport/lib/active_support/core_ext/range/include_range.rb
index 3a07401c8a..9d20920dd0 100644
--- a/activesupport/lib/active_support/core_ext/range/include_range.rb
+++ b/activesupport/lib/active_support/core_ext/range/include_range.rb
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/module/aliasing'
-
class Range
# Extends the default Range#include? to support range comparisons.
# (1..5).include?(1..5) # => true
@@ -18,6 +16,8 @@ class Range
include_without_range?(value)
end
end
-
- alias_method_chain :include?, :range
+ # TODO: change to Module#prepend as soon as the fix is backported to MRI 2.2:
+ # https://bugs.ruby-lang.org/issues/10847
+ alias_method :include_without_range?, :include?
+ alias_method :include?, :include_with_range?
end