Method: Doing::WWID#last_note

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

#last_note(section = 'All') ⇒ Object

Return the content of the last note for a given section

Parameters:

  • section (String) (defaults to: 'All')

    The section to retrieve from, default All

Raises:

  • (NoEntryError)


298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/doing/wwid/display.rb', line 298

def last_note(section = 'All')
  section = guess_section(section)

  last_item = last_entry({ section: section })

  raise NoEntryError, 'No entry found' unless last_item

  logger.log_now(:info, 'Edit note:', last_item.title)

  note = last_item.note&.to_s || ''
  "#{last_item.title}\n# EDIT BELOW THIS LINE ------------\n#{note}"
end