Class: Commands::Clients

Inherits:
Object
  • Object
show all
Defined in:
lib/detom/commands/clients.rb

Instance Method Summary collapse

Constructor Details

#initialize(store = YamlFileStore.new) ⇒ Clients

Returns a new instance of Clients.



3
4
5
# File 'lib/detom/commands/clients.rb', line 3

def initialize(store=YamlFileStore.new)
  @store = store
end

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/detom/commands/clients.rb', line 7

def call
  @store.each do |client, tracked_time|
    if tracked_time.nil?
      puts client
      next
    end

    total_time = tracked_time.map {|key, value| value.reduce(&:+) }.reduce &:+
    puts "#{client} #{total_time}m"
  end
end