Class: Ankit::Challenge::MessageState

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, #keep_pumping_until, #line, #over?, #runtime, #say, #session, #show_and_ask_enter, #show_breaking_status, #show_summary_header

Constructor Details

#initialize(progress, message) ⇒ MessageState

Returns a new instance of MessageState.



332
333
334
335
# File 'lib/ankit/challenge.rb', line 332

def initialize(progress, message)
  super(progress)
  @message = message
end

Instance Method Details

#pumpObject



337
338
339
340
341
342
343
# File 'lib/ankit/challenge.rb', line 337

def pump
  say(@message, :fail) # XXX: should :error
  answered = ask().strip
  pump_slash_or(answered) do
    pump_slash(answered)
  end
end