Sha256: 1a8e11c8f66bc136fece0eeaaca17d2c44b4bdd288c71e9b5d667ca88385a3ab

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

require 'pp'

module Doro
  module Entries

    def self.display_entries(doro_file: "#{Dir.home}/.doro", num_entries: 10)
      rows = []
      start_index = num_entries

      CSV.foreach doro_file do |row|
        rows << row
      end

      if rows.size < num_entries
        start_index = rows.size
      end

      start_index *= -1

      pp rows[start_index..-1]
    end

    def self.add_entry(
      doro_file: "#{Dir.home}/.doro",
      task_name: 'none',
      minutes: 25,
      start_time:,
      tag: 'untagged')
      CSV.open(doro_file, "ab") do |csv|
        csv << [task_name, minutes, start_time.to_s, tag]
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
doro-0.2.4 lib/doro/entries.rb