Class: USaidWat::CLI::TimelineFormatter
- Inherits:
-
Object
- Object
- USaidWat::CLI::TimelineFormatter
- Includes:
- TTYFormatter
- Defined in:
- lib/usaidwat/formatter/timeline.rb
Instance Method Summary collapse
Methods included from TTYFormatter
Instance Method Details
#format(comment_data) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/usaidwat/formatter/timeline.rb', line 6 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 |