class AocCli::Day::Requests::Puzzle

Public Instance Methods

init_stats() click to toggle source
# File lib/aoc_cli/day.rb, line 96
def init_stats
        Database::Stats::Init
                .new(d:day, p:part)
                .init if part < 3 && !stats_exist?
end
page() click to toggle source
# File lib/aoc_cli/day.rb, line 87
def page
        :Puzzle
end
parse(raw:fetch) click to toggle source
# File lib/aoc_cli/day.rb, line 90
def parse(raw:fetch)
        raw.chunk(f:"<article", t:"<\/article", f_off:2)
                .md
                .gsub(/(?<=\])\[\]/, "")
                .gsub(/\n.*<!--.*-->.*\n/, "")
end
stats_exist?() click to toggle source
# File lib/aoc_cli/day.rb, line 101
def stats_exist?
        Database::Query
                .new(path:Paths::Database.cfg(user))
                .select(t:"stats", 
                                where:{year:year, day:day, part:part})
                .count > 0
end