Class: AocCli::Year::Progress

Inherits:
Meta
  • Object
show all
Defined in:
lib/aoc_cli/year.rb

Instance Attribute Summary

Attributes inherited from Meta

#paths, #user, #year

Instance Method Summary collapse

Methods inherited from Meta

#initialize

Constructor Details

This class inherits a constructor from AocCli::Year::Meta

Instance Method Details

#calObject



25
26
27
28
# File 'lib/aoc_cli/year.rb', line 25

def cal
  @cal ||= Requests::Calendar.new(u:user, y:year)
    .fill(stars:stats.stars)
end

#fileObject



29
30
31
# File 'lib/aoc_cli/year.rb', line 29

def file
  Files::Calendar.new(stats:stats, cal:cal).make
end

#init_calendar_dbObject



39
40
41
42
43
# File 'lib/aoc_cli/year.rb', line 39

def init_calendar_db
  Database::Calendar::Init
    .new(u:user, y:year, stars:stats.stars)
    .insert
end

#statsObject



22
23
24
# File 'lib/aoc_cli/year.rb', line 22

def stats
  @stats ||= Requests::Stats.new(u:user, y:year)
end

#writeObject



35
36
37
38
# File 'lib/aoc_cli/year.rb', line 35

def write
  File.write(paths.local(f:"Stars"), file) if write?
  self
end

#write?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/aoc_cli/year.rb', line 32

def write?
  Prefs.bool(key:"calendar_file")
end