Class: AocCli::Processors::PuzzleDirSynchroniser

Inherits:
Core::Processor show all
Extended by:
Forwardable
Defined in:
lib/aoc_cli/processors/puzzle_dir_synchroniser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Processor

#run!, run!

Instance Attribute Details

#locationObject

Returns the value of attribute location.



6
7
8
# File 'lib/aoc_cli/processors/puzzle_dir_synchroniser.rb', line 6

def location
  @location
end

#puzzleObject

Returns the value of attribute puzzle.



6
7
8
# File 'lib/aoc_cli/processors/puzzle_dir_synchroniser.rb', line 6

def puzzle
  @puzzle
end

#skip_cacheObject

Returns the value of attribute skip_cache.



6
7
8
# File 'lib/aoc_cli/processors/puzzle_dir_synchroniser.rb', line 6

def skip_cache
  @skip_cache
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
# File 'lib/aoc_cli/processors/puzzle_dir_synchroniser.rb', line 20

def run
  refresh_puzzle! if skip_cache

  create_puzzle_dir_sync_log!.tap do
    puzzle_file.write(puzzle.content)
    input_file.write(puzzle.input)
  end
end

#validateObject

TODO: replace with conditional validation



15
16
17
18
# File 'lib/aoc_cli/processors/puzzle_dir_synchroniser.rb', line 15

def validate
  super
  validate_puzzle_dir_exists! if errors.empty?
end