Class: AocCli::Paths::Year
- Inherits:
-
Object
- Object
- AocCli::Paths::Year
- Defined in:
- lib/aoc_cli/paths.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
- #filename(f:) ⇒ Object
- #in_year? ⇒ Boolean
-
#initialize(u: Metafile.get(:user), y: Metafile.get(:year)) ⇒ Year
constructor
A new instance of Year.
- #local(f:) ⇒ Object
- #year_dir ⇒ Object
Constructor Details
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/aoc_cli/paths.rb', line 5 def user @user end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
5 6 7 |
# File 'lib/aoc_cli/paths.rb', line 5 def year @year end |
Instance Method Details
#filename(f:) ⇒ Object
22 23 24 25 26 27 |
# 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? ⇒ Boolean
11 12 13 14 |
# File 'lib/aoc_cli/paths.rb', line 11 def in_year? File.exist?("./.meta") ? Metafile.type == :ROOT : true end |
#local(f:) ⇒ Object
18 19 20 21 |
# 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 ⇒ Object
15 16 17 |
# File 'lib/aoc_cli/paths.rb', line 15 def year_dir in_year? ? "." : ".." end |