Module: IceCube::Validations::SecondOfMinute
- Included in:
- DailyRule, HourlyRule, MinutelyRule, MonthlyRule, SecondlyRule, WeeklyRule, YearlyRule
- Defined in:
- lib/ice_cube/validations/second_of_minute.rb
Defined Under Namespace
Classes: Validation
Instance Method Summary collapse
Instance Method Details
#realign(opening_time, start_time) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/ice_cube/validations/second_of_minute.rb', line 17 def realign(opening_time, start_time) return super unless validations[:second_of_minute] first_second = Array(validations[:second_of_minute]).min_by(&:value) time = TimeUtil::TimeWrapper.new(start_time, false) time.sec = first_second.value super(opening_time, time.to_time) end |
#second_of_minute(*seconds) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ice_cube/validations/second_of_minute.rb', line 3 def second_of_minute(*seconds) seconds.flatten.each do |second| unless second.is_a?(Integer) raise ArgumentError, "Expecting Integer value for second, got #{second.inspect}" end verify_alignment(second, :sec, :second_of_minute) { |error| raise error } validations_for(:second_of_minute) << Validation.new(second) end clobber_base_validations :sec self end |