Sha256: 0c4b60391d20236305947f0e0ef5078500767f7882e51ff0ec8418482d613315
Contents?: true
Size: 865 Bytes
Versions: 1
Compression:
Stored size: 865 Bytes
Contents
require 'date' require 'markdo/commands/command' module Markdo class ForecastCommand < Command def run dates_over_the_next_week.each do |date| abbreviation = abbreviations_by_wday(date.wday) count = task_collection.due_on(date).length @stdout.puts("#{abbreviation}: #{count}") end due_next_week = task_collection.due_between(@today + 7, @today + 14) @stdout.puts("Next: #{due_next_week.length}") end private def abbreviations_by_wday(wday) abbrevs = { 0 => 'Su', 1 => 'Mo', 2 => 'Tu', 3 => 'We', 4 => 'Th', 5 => 'Fr', 6 => 'Sa', } abbrevs[wday] end private def dates_over_the_next_week (2..7).to_a.map { |offset| @today + offset } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
markdo-0.2.0 | lib/markdo/commands/forecast_command.rb |