Sha256: dae1d86fb5186b0cc6f38d23eb0bd0fe91f07c9ea89d2288ba0ec2e159bc3e6f

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 Bytes

Contents

require 'stringio'

require 'markdo/command'
require 'markdo/overdue_command'
require 'markdo/star_command'
require 'markdo/today_command'
require 'markdo/tomorrow_command'

module Markdo
  class SummaryCommand < Command
    def run
      commands = [OverdueCommand, StarCommand, TodayCommand, TomorrowCommand]

      commands.each do |command|
        out = StringIO.new
        command.new(out, @stderr, @env).run

        title = command.to_s.sub(/^Markdo::/, '').sub(/Command$/, '')
        lines = out.string.split("\n")
        sum =  lines.length.inspect

        @stdout.puts("#{title}: #{sum}")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
markdo-0.1.7 lib/markdo/summary_command.rb
markdo-0.1.6 lib/markdo/summary_command.rb
markdo-0.1.5 lib/markdo/summary_command.rb