Class: Rbnotes::Commands::Statistics

Inherits:
Command
  • Object
show all
Defined in:
lib/rbnotes/commands/statistics.rb

Overview

Shows statistics.

Instance Method Summary collapse

Instance Method Details

#descriptionObject

:nodoc:



7
8
9
# File 'lib/rbnotes/commands/statistics.rb', line 7

def description             # :nodoc:
  "Show statistics values"
end

#execute(args, conf) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rbnotes/commands/statistics.rb', line 11

def execute(args, conf)
  @opts = {}
  parse_opts(args)

  report = :total
  if @opts[:yearly]
    report = :yearly
  elsif @opts[:monthly]
    report = :monthly
  end

  stats = Rbnotes::Statistics.new(conf)
  case report
  when :yearly
    stats.yearly_report
  when :monthly
    stats.monthly_report
  else
    stats.total_report
  end
end

#helpObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rbnotes/commands/statistics.rb', line 33

def help
  puts <<HELP
usage:
#{Rbnotes::NAME} statistics ([-y|--yearly]|[-m|--monthly])

option:
-y, --yearly  : print yearly report
-m, --monthly : print monthly report

Show statistics.

In the version #{Rbnotes::VERSION}, only number of notes is supported.
HELP
end