class AocCli::Tables::Table

Attributes

cols[R]
table[R]
user[R]
where[R]
year[R]

Public Class Methods

new(u:Metafile.get(:user), y:Metafile.get(:year)) click to toggle source
# File lib/aoc_cli/tables.rb, line 6
def initialize(u:Metafile.get(:user), y:Metafile.get(:year))
        @user = Validate.user(u)
        @year = Validate.year(y)
end

Public Instance Methods

border() click to toggle source
# File lib/aoc_cli/tables.rb, line 10
def border
        Prefs.bool(key:"unicode_tables") ? :unicode : :ascii
end
data() click to toggle source
# File lib/aoc_cli/tables.rb, line 13
def data
        Database::Query
                .new(path:Paths::Database.cfg(user))
                .select(t:table, cols:cols, where:where)
end
make() click to toggle source
# File lib/aoc_cli/tables.rb, line 21
def make
        tab = Terminal::Table.new(
                :headings  => headings,
                :rows      => rows,
                :title     => title)
        tab.style = {
                :border    => border, 
                :alignment => :center}
        tab
end
print() click to toggle source