Class: Ankit::Challenge::QuestionState
- Includes:
- SlashRecognizing
- Defined in:
- lib/ankit/challenge.rb
Instance Attribute Summary collapse
-
#flash ⇒ Object
readonly
Returns the value of attribute flash.
Attributes inherited from State
Instance Method Summary collapse
Methods included from SlashRecognizing
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 Attribute Details
#flash ⇒ Object (readonly)
Returns the value of attribute flash.
348 349 350 |
# File 'lib/ankit/challenge.rb', line 348 def flash @flash end |
Instance Method Details
#pump ⇒ Object
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/ankit/challenge.rb', line 350 def pump progress.attack runtime.clear_screen show_header card = progress.current_card say("#{card.translation}") say("#{card.hidden_original}", :cont) answered = ask().strip pump_slash_or(answered) do case card.match?(answered.strip) when :match PassedState.new(progress, answered) when :wrong FailedState.new(progress, answered) when :typo TypoState.new(progress, answered) else raise end end end |
#put_flash(flash) ⇒ Object
372 373 374 375 |
# File 'lib/ankit/challenge.rb', line 372 def put_flash(flash) @flash = flash self end |