Class: Worklog::Services::GetWorklogs
- Defined in:
- lib/worklog/services/get_worklogs.rb
Overview
This service loads all timelogs in the working directory. Several timelogs that share the same title will be merged to single sheet with the shared title
Instance Method Summary collapse
Methods inherited from Service
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/worklog/services/get_worklogs.rb', line 17 def call [].tap do |logs| Dir.glob(::LOGMASK) do |f| puts "Processing #{f}.." flog = DSL.build() { read_file(f) } # merge by sheet title mlog = logs.find{|i| i.title == flog.title} mlog.nil? ? logs << flog : mlog.merge!(flog) end end end |