Class: AocCli::Presenters::AttemptPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/aoc_cli/presenters/attempt_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attempt) ⇒ AttemptPresenter

Returns a new instance of AttemptPresenter.



6
7
8
# File 'lib/aoc_cli/presenters/attempt_presenter.rb', line 6

def initialize(attempt)
  @attempt = attempt
end

Instance Attribute Details

#attemptObject (readonly)

Returns the value of attribute attempt.



4
5
6
# File 'lib/aoc_cli/presenters/attempt_presenter.rb', line 4

def attempt
  @attempt
end

Instance Method Details

#hintObject



20
21
22
23
24
25
26
# File 'lib/aoc_cli/presenters/attempt_presenter.rb', line 20

def hint
  case attempt.hint
  when :too_low  then "Too low"
  when :too_high then "Too high"
  else "-"
  end
end

#statusObject



10
11
12
13
14
15
16
17
18
# File 'lib/aoc_cli/presenters/attempt_presenter.rb', line 10

def status
  case attempt.status
  when :wrong_level  then "Wrong level"
  when :rate_limited then "Rate limited"
  when :incorrect    then "Incorrect"
  when :correct      then "Correct"
  else raise
  end
end