Method: Doing::WWID#recent

Defined in:
lib/doing/wwid/display.rb

#recent(count = 10, section = nil, opt) ⇒ Object

Show recent entries

Parameters:

  • count (Integer) (defaults to: 10)

    The number to show

  • section (String) (defaults to: nil)

    The section to show from, default Currently

  • opt (Hash)

    Additional Options



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/doing/wwid/display.rb', line 213

def recent(count = 10, section = nil, opt)
  opt ||= {}
  times = opt[:t] || true
  opt[:totals] ||= false
  opt[:sort_tags] ||= false

  cfg = Doing.setting('templates.recent').deep_merge(Doing.setting('templates.default'), { extend_existing_arrays: true, sort_merged_arrays: true }).deep_merge({
    'wrap_width' => Doing.setting('wrap_width') || 0,
    'date_format' => Doing.setting('default_date_format'),
    'order' => Doing.setting('order') || :asc,
    'tags_color' => Doing.setting('tags_color'),
    'duration' => Doing.setting('duration'),
    'interval_format' => Doing.setting('interval_format')
  }, { extend_existing_arrays: true, sort_merged_arrays: true })
  opt[:duration] ||= cfg['duration'] || false
  opt[:interval_format] ||= cfg['interval_format'] || 'text'

  section ||= Doing.setting('current_section')
  section = guess_section(section)

  opt[:section] = section
  opt[:wrap_width] = cfg['wrap_width']
  opt[:count] = count
  opt[:format] = cfg['date_format']
  opt[:template] = opt[:template] || cfg['template']
  opt[:order] = :asc
  opt[:times] = times

  list_section(opt)
end