File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -140,21 +140,19 @@ def find_acceptable_time_before(boundary)
140
140
true
141
141
end
142
142
143
+ # Returns true if all validations for the current rule match
144
+ # otherwise false and shifts to the first (largest) unmatched offset
145
+ #
143
146
def validation_accepts_or_updates_time? ( validations_for_type )
144
- res = validated_results ( validations_for_type )
145
- return true if res . any? { |r | r . nil? || r == 0 }
146
- return nil if res . all? { |r | r == true }
147
- res . reject! { |r | r == true }
147
+ res = validations_for_type . each_with_object ( [ ] ) do |validation , offsets |
148
+ r = validation . validate ( @time , @schedule )
149
+ return true if r . nil? || r == 0
150
+ offsets << r
151
+ end
148
152
shift_time_by_validation ( res , validations_for_type . first )
149
153
false
150
154
end
151
155
152
- def validated_results ( validations_for_type )
153
- validations_for_type . map do |validation |
154
- validation . validate ( @time , @schedule )
155
- end
156
- end
157
-
158
156
def shift_time_by_validation ( res , validation )
159
157
return unless ( interval = res . min )
160
158
wrapper = TimeUtil ::TimeWrapper . new ( @time , validation . dst_adjust? )
You can’t perform that action at this time.
0 commit comments