class AocCli::Paths::Year
Attributes
user[R]
year[R]
Public Class Methods
new(u:Metafile.get(:user), y:Metafile.get(:year))
click to toggle source
# File lib/aoc_cli/paths.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
filename(f:)
click to toggle source
# File lib/aoc_cli/paths.rb, line 22 def filename(f:) case f.to_sym when :Stars then "#{year}.md" when :meta then ".meta" end end
in_year?()
click to toggle source
# File lib/aoc_cli/paths.rb, line 11 def in_year? File.exist?("./.meta") ? Metafile.type == :ROOT : true end
local(f:)
click to toggle source
# File lib/aoc_cli/paths.rb, line 18 def local(f:) "#{Validate.not_init(dir:year_dir, year:year)}/#{filename(f:f)}" end
year_dir()
click to toggle source
# File lib/aoc_cli/paths.rb, line 15 def year_dir in_year? ? "." : ".." end