Class: AocCli::PuzzleController
Instance Method Summary
collapse
#execute
#heading, #main_header, #success_tag, #table_for, #wrap_text
#current_event, #current_location, #current_path, #current_puzzle, #ensure_in_aoc_dir!, #ensure_in_event_dir!, #ensure_in_puzzle_dir!, #ensure_not_in_aoc_dir!
#render_error!, #render_model_errors!
Instance Method Details
#attempts ⇒ Object
33
34
35
36
37
|
# File 'lib/aoc_cli/controllers/puzzle_controller.rb', line 33
def attempts
return unless ensure_in_puzzle_dir!
Components::AttemptsTable.new(puzzle: current_puzzle || raise).render
end
|
#init ⇒ Object
3
4
5
6
7
8
9
10
|
# File 'lib/aoc_cli/controllers/puzzle_controller.rb', line 3
def init
return unless ensure_in_event_dir!
@puzzle = Processors::PuzzleInitialiser.run!(
event: current_event,
day: target_id
)
end
|
#solve ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/aoc_cli/controllers/puzzle_controller.rb', line 12
def solve
return unless ensure_in_puzzle_dir!
@attempt = Processors::SolutionPoster.run!(
puzzle: current_puzzle,
answer: params[:answer]
)
end
|
#sync ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/aoc_cli/controllers/puzzle_controller.rb', line 21
def sync
return unless ensure_in_puzzle_dir!
@sync_log = Processors::PuzzleDirSynchroniser.run!(
puzzle: current_puzzle,
location: current_location,
skip_cache: params[:skip_cache] || false
)
Components::PuzzleSyncComponent.new(log: @sync_log).render
end
|