Sha256: c9aff585a94c4ec00e9a373b6ee71937835611f9d350c9438906427bf66f9e57
Contents?: true
Size: 641 Bytes
Versions: 4
Compression:
Stored size: 641 Bytes
Contents
module USaidWat module CLI class TimelineFormatter include TTYFormatter def format(comment_data) out = StringIO.new out.write(' ') (0..23).each { |h| out.write(sprintf '%3s', h) } out.write("\n") comment_data.each_with_index do |day, i| out.write(day_map(i)) day.each do |hour| mark = hour > 0 ? '*' : ' ' out.write(sprintf "%3s", mark) end out.write("\n") end out.rewind out.read end private def day_map(i) return %W{S M T W T F S}[i] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems