class AocCli::Files::Calendar

Attributes

cal[R]
stats[R]
year[R]

Public Class Methods

new(y:Metafile.get(:year), cal:, stats:) click to toggle source
# File lib/aoc_cli/files.rb, line 140
def initialize(y:Metafile.get(:year), cal:, stats:)
        @year, @cal, @stats  = Validate.year(y), cal, stats
end

Public Instance Methods

include_leaderboard?() click to toggle source
# File lib/aoc_cli/files.rb, line 143
def include_leaderboard?
        Prefs.bool(key:"lb_in_calendar")
end
make() click to toggle source
# File lib/aoc_cli/files.rb, line 152
                        def make
                                <<~file
                                        #{title}
                                        #{underline}
                                        #{cal.data.join("\n")}\n
                                        #{stats.data.join("\n") if stats.total_stars > 0 &&
                                                include_leaderboard?}
                                file
                        end
title() click to toggle source
# File lib/aoc_cli/files.rb, line 146
def title
        "Year #{year}: #{stats.total_stars}/50 *"
end
underline() click to toggle source
# File lib/aoc_cli/files.rb, line 149
def underline
        "-" * (cal.data[0].to_s.length + 2)
end