Sha256: 7b62c2c97641ec2b01c849a68a6afd49856241c98dc4f412562e5ed41f1c6d4c

Contents?: true

Size: 601 Bytes

Versions: 9

Compression:

Stored size: 601 Bytes

Contents

require 'active_support/core_ext/module/aliasing'
require 'active_support/core_ext/object/acts_like'

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

  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

  private
  def ensure_iteration_allowed
    if first.acts_like?(:time)
      raise TypeError, "can't iterate from #{first.class}"
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activesupport-4.0.3 lib/active_support/core_ext/range/each.rb
activesupport-4.1.0.beta2 lib/active_support/core_ext/range/each.rb
activesupport-4.1.0.beta1 lib/active_support/core_ext/range/each.rb
activesupport-4.0.2 lib/active_support/core_ext/range/each.rb
activesupport-4.0.1 lib/active_support/core_ext/range/each.rb
activesupport-4.0.1.rc4 lib/active_support/core_ext/range/each.rb
activesupport-4.0.1.rc3 lib/active_support/core_ext/range/each.rb
activesupport-4.0.1.rc2 lib/active_support/core_ext/range/each.rb
activesupport-4.0.1.rc1 lib/active_support/core_ext/range/each.rb