module PunchTime
Constants
- VERSION
Public Class Methods
configure(&config)
click to toggle source
# File lib/punch_time.rb, line 14 def configure(&config) Thread.current[:time_record] = TimeRecord.new(&config) end
Private Class Methods
time_record()
click to toggle source
# File lib/punch_time.rb, line 31 def time_record Thread.current[:time_record] || raise(Error::Configuration, "#{name} not configured") end
Private Instance Methods
no_format()
click to toggle source
# File lib/punch_time/configuration.rb, line 75 def no_format %i[shift_in_time shift_out_time].map do |x| errors.add(x, 'Allow only Time format') unless public_send(x).is_a?(Time) end errors.add(:night, 'Allow only Time format') unless night[:start_time].is_a?(Time) errors.add(:night, 'Allow only Time format') unless night[:end_time].is_a?(Time) errors.add(:offset, 'Allow only String format') unless offset.is_a?(String) breaks.each do |x| unless x[:start_time].blank? || x[:start_time].is_a?(Time) errors.add(:breaks, 'Allow only Time format') end unless x[:end_time].blank? || x[:end_time].is_a?(Time) errors.add(:breaks, 'Allow only Time format') end end end