class AocCli::Solve::Respond::Incorrect

Public Instance Methods

high() click to toggle source
# File lib/aoc_cli/solve.rb, line 79
def high
        /too high/.match?(attempt.raw)
end
low() click to toggle source
# File lib/aoc_cli/solve.rb, line 82
def low
        /too low/.match?(attempt.raw)
end
react() click to toggle source
# File lib/aoc_cli/solve.rb, line 64
def react
        Database::Attempt
                .new(attempt:attempt)
                .incorrect(high:high, low:low)
end
respond() click to toggle source
# File lib/aoc_cli/solve.rb, line 69
                                def respond
                                        puts <<~response
                                        #{"Incorrect".red.bold}: You guessed - #{attempt
                                                .answer.to_s.red} #{
                                        high ? "(too high)" : 
                                        low  ? "(too low)"  : ""}
                                        #{"Please wait".yellow} #{wait_time} before answering again
                                        response
                                        self
                                end
wait_time() click to toggle source
# File lib/aoc_cli/solve.rb, line 85
def wait_time
        attempt.raw.scan(/(?:(one minute|\d+ minutes))/)
                .first.first.to_s
end