DeepCover
v0.1.16
1 | # frozen_string_literal: true |
2 | |
3 | require "active_support/time_with_zone" |
4 | |
5 | module 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 |
23 | end |
24 | |
25 | Range.prepend(ActiveSupport::EachTimeWithZone) |