class Getulio::TimesheetDay
Constants
- TOTAL_WORKING_TIME_SECODS
Public Class Methods
new(date)
click to toggle source
# File lib/getulio/timesheet_day.rb, line 6 def initialize(date) @date = date end
Public Instance Methods
arrival()
click to toggle source
# File lib/getulio/timesheet_day.rb, line 14 def arrival @arrival ||= random_time(7,10) end
begin_of_lunch()
click to toggle source
# File lib/getulio/timesheet_day.rb, line 18 def begin_of_lunch @begin_of_lunch ||= random_time(11,13) end
date()
click to toggle source
# File lib/getulio/timesheet_day.rb, line 10 def date @date end
departure()
click to toggle source
# File lib/getulio/timesheet_day.rb, line 26 def departure remaining_time = TOTAL_WORKING_TIME_SECODS - (begin_of_lunch - arrival) end_of_lunch + remaining_time end
end_of_lunch()
click to toggle source
# File lib/getulio/timesheet_day.rb, line 22 def end_of_lunch begin_of_lunch + 60*60 end
Private Instance Methods
random_time(from,to)
click to toggle source
# File lib/getulio/timesheet_day.rb, line 33 def random_time(from,to) hour = rand((to-1 - from)) + from minutes = rand(59) Time.local(@date.year, @date.month, @date.day, hour, minutes) end