Method: Generator#ls

Defined in:
lib/nikki.rb

#lsString

Display Nikki’s latest entires

Parameters:

  • options (Hash)

    a customizable set of options

Returns:

  • (String)

52
53
54
55
56
57
58
59
60
61
# File 'lib/nikki.rb', line 52

def ls
  YAML::Store.new(NIKKI_FILE).transaction do |store|
    entries = store['entries'].last(5)
    entries.each do |entry|
      entry.each do |date, text|
        puts "#{date}: #{text}"
      end
    end
  end
end