module IceCube::Validations::SecondOfMinute

Public Instance Methods

realign(opening_time, start_time) click to toggle source
Calls superclass method
# File lib/ice_cube/validations/second_of_minute.rb, line 19
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) click to toggle source
# File lib/ice_cube/validations/second_of_minute.rb, line 5
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