Class: AocCli::Processors::StatsInitialiser

Inherits:
Core::Processor show all
Defined in:
lib/aoc_cli/processors/stats_initialiser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Processor

#run!, run!

Instance Attribute Details

#eventObject

Returns the value of attribute event.



4
5
6
# File 'lib/aoc_cli/processors/stats_initialiser.rb', line 4

def event
  @event
end

Instance Method Details

#runObject



13
14
15
16
17
# File 'lib/aoc_cli/processors/stats_initialiser.rb', line 13

def run
  stats = BLANK_STATS.merge(fetch_stats!)

  Stats.create(event:, **stats)
end

#validateObject



8
9
10
11
# File 'lib/aoc_cli/processors/stats_initialiser.rb', line 8

def validate
  super
  validate_stats_do_not_exist! if errors.empty?
end