Class: AdventOfCode::Commands::Example::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/advent_of_code_cli/commands/example.rb

Instance Method Summary collapse

Instance Method Details

#new(day, name) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/advent_of_code_cli/commands/example.rb', line 11

def new(day, name)
  New.new(day: day.to_i, name: name).execute
rescue ExampleAlreadyExistsError => e
  say(e.message, :red)
rescue InvalidDayError
  rescue_invalid_day_error
end

#solve(day, name) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/advent_of_code_cli/commands/example.rb', line 20

def solve(day, name)
  Solve.new(day: day.to_i, name: name).execute
rescue InvalidDayError
  rescue_invalid_day_error
rescue MissingExampleError
  say "Error: Cannot find example file.", :red
rescue AdventOfCode::MissingSolutionError
  say "Error: Cannot find solution file.", :red
end