NodesCharsBranches
34 / 35303 / 3041 / 1
DeepCover v0.1.16
1# frozen_string_literal: true
2
3require "active_support/time_with_zone"
4
5module ActiveSupport
6 module EachTimeWithZone #:nodoc:
7 def each(&block)
8 ensure_iteration_allowed
9 super
10 end
11
12 def step(n = 1, &block)
13 ensure_iteration_allowed
14 super
15 end
16
17 private
18
19 def ensure_iteration_allowed
20 raise TypeError, "can't iterate from #{first.class}" if first.is_a?(TimeWithZone)
21 end
22 end
23end
24
25Range.prepend(ActiveSupport::EachTimeWithZone)