Class: Ptimelog::Command::Show

Inherits:
Base
  • Object
show all
Defined in:
lib/ptimelog/command/show.rb

Overview

show entries of one day or all of them

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Ptimelog::Command::Base

Instance Method Details

#entries=(entries) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ptimelog/command/show.rb', line 21

def entries=(entries)
  entries.each do |date, list|
    @entries[date] = []

    list.each do |entry|
      @entries[date] << [
        entry.start_time, '-', entry.finish_time,
        [
          entry.ticket,
          entry.description,
          entry.tags,
          entry.,
          (entry.billable? ? '$' : nil),
        ].compact.join(' ∴ '),
      ].compact.join(' ')
    end
  end
end

#needs_entries?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/ptimelog/command/show.rb', line 7

def needs_entries?
  true
end

#runObject



11
12
13
14
15
16
17
18
19
# File 'lib/ptimelog/command/show.rb', line 11

def run
  @entries.each do |date, list|
    puts date, '----------'
    list.each do |entry|
      puts entry
    end
    puts nil
  end
end