diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/range/each.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/range/each.rb | 12 |
1 files changed, 8 insertions, 4 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 |