Class: AocCli::Processors::PuzzleInitialiser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Processor

#run!, run!

Instance Attribute Details

#dayObject

Returns the value of attribute day.



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

def day
  @day
end

#eventObject

Returns the value of attribute event.



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

def event
  @event
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
# File 'lib/aoc_cli/processors/puzzle_initialiser.rb', line 17

def run
  create_or_update_puzzle!(fetch_content!, fetch_input!).tap do |puzzle|
    sync_puzzle_progress!(puzzle)

    attach_puzzle_dir!(puzzle).tap do |location|
      write_puzzle_files!(puzzle, location)
    end
  end
end

#validateObject



9
10
11
12
13
14
15
# File 'lib/aoc_cli/processors/puzzle_initialiser.rb', line 9

def validate
  super
  validate_event_stats_set! if errors.empty?
  validate_event_location_set! if errors.empty?
  validate_event_dir_exists! if errors.empty?
  validate_puzzle_dir_does_not_exist! if errors.empty?
end