Class: Ankit::Challenge::FailedState

Inherits:
State
  • Object
show all
Includes:
SlashRecognizing
Defined in:
lib/ankit/challenge.rb

Instance Attribute Summary

Attributes inherited from State

#last_answer, #progress

Instance Method Summary collapse

Methods included from SlashRecognizing

#pump_slash, #pump_slash_or

Methods inherited from State

#ask, #erase_last, #initialize, #keep_pumping_until, #line, #over?, #runtime, #say, #session, #show_and_ask_enter, #show_breaking_status, #show_summary_header

Constructor Details

This class inherits a constructor from Ankit::Challenge::State

Instance Method Details

#pumpObject



393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/ankit/challenge.rb', line 393

def pump
  original = progress.current_card.corrected_original_over(last_answer)
  typed = progress.current_card.hilight_against_original(last_answer)
  typed = "\n" if typed.empty?
  erase_last
  say("#{typed}", :ask)
  say("#{original}", :fail)
  answered = ask("", :hit_return)
  pump_slash_or(answered) do
    progress.fail
    QuestionState.new(progress)
  end
end