Class: Ankit::Challenge::RefillState

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

Instance Attribute Summary

Attributes inherited from State

#last_answer, #progress

Instance Method Summary collapse

Methods included from Approaching

#initial_state

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

#ask_overObject



449
450
451
452
453
454
455
456
457
458
# File 'lib/ankit/challenge.rb', line 449

def ask_over
  case line.ask("Over(Y/n/?) ").strip
  when /^y/, ""
    :yes
  when /^n/
    :no
  else
    :help
  end  
end

#pumpObject



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/ankit/challenge.rb', line 432

def pump
  return initial_state unless session.reached_limit?

  runtime.clear_screen
  show_breaking_status
  case ask_over
  when :yes
    runtime.clear_screen
    OverState.new(progress)
  when :no
    initial_state
  else
    # TODO: handle help
    self
  end
end