class AocCli::Day::Cache

Public Class Methods

new(u:Metafile.get(:user), y:Metafile.get(:year), d:Metafile.get(:day), f:[:Input, :Puzzle]) click to toggle source
Calls superclass method AocCli::Day::Pages::new
# File lib/aoc_cli/day.rb, line 52
def initialize(u:Metafile.get(:user), 
                           y:Metafile.get(:year),
                           d:Metafile.get(:day),
                           f:[:Input, :Puzzle])
        super(u:u, y:y, d:d, f:f)
        paths.create_cache
end

Public Instance Methods

query() click to toggle source
# File lib/aoc_cli/day.rb, line 59
def query
        files.map{|file| [file, read(file:file)]}.to_h
end

Private Instance Methods

read(file:) click to toggle source
# File lib/aoc_cli/day.rb, line 63
def read(file:)
        File.exist?(paths.cache_path(f:file)) ?
                File.read(paths.cache_path(f:file)) : nil
end