Sha256: 38c54d4dd8630bd0e196d600bb001f1fd263109c7d33c1ea54b9691b332b9b96
Contents?: true
Size: 980 Bytes
Versions: 1
Compression:
Stored size: 980 Bytes
Contents
# encoding: utf-8 module TokiCLI class View def total_table(list) table = init_table table.title = "Your apps monitored by Toki" list.each do |k,v| table << ["#{k}", "#{v}"] end table end def app_table(asked, app_data) table = init_table table.title = "Toki time tracking for '#{asked}'" table.headings = ['From', 'To', 'Duration'] @index = 0 @length = app_data.length - 1 app_data.each do |id, log| if id == 'total' @total = log next end @index += 1 table << ["#{log[:from]}", "#{log[:to]}", "#{log[:duration]}"] table << :separator unless @index == @length end table << :separator table << [{ :value => "Total: #{@total}", :colspan => 3, :alignment => :center }] table end private def init_table Terminal::Table.new do |t| t.style = { :width => 75 } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
TokiCLI-0.0.1 | lib/TokiCLI/view.rb |