aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/range/each.rb
blob: dc6dad5ceddc2b4b6e0bf056df12853df2e9e857 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11





                                  
 



                              
 
           
 


                                                                                 

     

                                              
module ActiveSupport
  module EachTimeWithZone #:nodoc:
    def each(&block)
      ensure_iteration_allowed
      super
    end

    def step(n = 1, &block)
      ensure_iteration_allowed
      super
    end

    private

      def ensure_iteration_allowed
        raise TypeError, "can't iterate from #{first.class}" if first.is_a?(Time)
      end
  end
end

Range.prepend(ActiveSupport::EachTimeWithZone)