File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,21 +140,19 @@ def find_acceptable_time_before(boundary)
140140 true
141141 end
142142
143+ # Returns true if all validations for the current rule match
144+ # otherwise false and shifts to the first (largest) unmatched offset
145+ #
143146 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
148152 shift_time_by_validation ( res , validations_for_type . first )
149153 false
150154 end
151155
152- def validated_results ( validations_for_type )
153- validations_for_type . map do |validation |
154- validation . validate ( @time , @schedule )
155- end
156- end
157-
158156 def shift_time_by_validation ( res , validation )
159157 return unless ( interval = res . min )
160158 wrapper = TimeUtil ::TimeWrapper . new ( @time , validation . dst_adjust? )
You can’t perform that action at this time.
0 commit comments