Class: Gpuzzletime::Command::Show

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

Overview

show entries of one day or all of them

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Show

Returns a new instance of Show.



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

def initialize(config)
  @config  = config
  @entries = {}
end

Instance Method Details

#entries=(entries) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/gpuzzletime/command/show.rb', line 26

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.,
        ].compact.join(' ∴ '),
      ].compact.join(' ')
    end
  end
end

#needs_entries?Boolean

Returns:



12
13
14
# File 'lib/gpuzzletime/command/show.rb', line 12

def needs_entries?
  true
end

#runObject



16
17
18
19
20
21
22
23
24
# File 'lib/gpuzzletime/command/show.rb', line 16

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