class AocCli::Tables::Calendar
Public Class Methods
new(u:Metafile.get(:user), y:Metafile.get(:year))
click to toggle source
Calls superclass method
AocCli::Tables::Table::new
# File lib/aoc_cli/tables.rb, line 117 def initialize(u:Metafile.get(:user), y:Metafile.get(:year)) super(u:u, y:y) @table = :calendar @cols = "*" @where = {year:year} end
Public Instance Methods
headings()
click to toggle source
# File lib/aoc_cli/tables.rb, line 127 def headings ["Day", "Stars"] end
parse_stars(day)
click to toggle source
# File lib/aoc_cli/tables.rb, line 133 def parse_stars(day) day.to_i == 0 ? ".." : ("*" * day.to_i).ljust(2, ".") end
rows()
click to toggle source
# File lib/aoc_cli/tables.rb, line 130 def rows @rows ||= data.map{|d| [d[1], parse_stars(d[2])]} end
title()
click to toggle source
# File lib/aoc_cli/tables.rb, line 124 def title "#{user}: #{year}" end