Class: AocCli::Processors::SolutionPoster

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Processor

#run!, run!

Instance Attribute Details

#answerObject

Returns the value of attribute answer.



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

def answer
  @answer
end

#puzzleObject

Returns the value of attribute puzzle.



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

def puzzle
  @puzzle
end

Instance Method Details

#runObject



18
19
20
21
22
# File 'lib/aoc_cli/processors/solution_poster.rb', line 18

def run
  create_attempt!(post_solution!).tap do |attempt|
    advance_puzzle! if attempt.correct?
  end
end

#validateObject

TODO: replace with conditional validation



11
12
13
14
15
16
# File 'lib/aoc_cli/processors/solution_poster.rb', line 11

def validate
  super
  validate_puzzle_location_set! if errors.empty?
  validate_stats_associated! if errors.empty?
  validate_puzzle_not_complete! if errors.empty?
end