Class: DayEntryLoader
- Inherits:
-
Object
- Object
- DayEntryLoader
- Includes:
- Utils
- Defined in:
- lib/konkit_worklogger/day_entry.rb
Instance Method Summary collapse
-
#initialize(configuration) ⇒ DayEntryLoader
constructor
A new instance of DayEntryLoader.
- #load_from_file(year, month, day) ⇒ Object
Methods included from Utils
#get_filename, #minutes_to_time
Constructor Details
#initialize(configuration) ⇒ DayEntryLoader
Returns a new instance of DayEntryLoader.
24 25 26 |
# File 'lib/konkit_worklogger/day_entry.rb', line 24 def initialize(configuration) @configuration = configuration end |
Instance Method Details
#load_from_file(year, month, day) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/konkit_worklogger/day_entry.rb', line 28 def load_from_file(year, month, day) filename = get_filename(@configuration, year, month, day) lines ||= CSV.readlines(filename) lines_count = lines.length start_time = lines[0][0] end_time = lines[lines_count - 1][0] DayEntry.new(lines_count, start_time, end_time) end |