Class: SchedulerInterruptListener
- Inherits:
- 
      Object
      
        - Object
- SchedulerInterruptListener
 
- Defined in:
- lib/run/scheduler_interrupt_listener.rb
Instance Method Summary collapse
- #continue? ⇒ Boolean
- 
  
    
      #initialize(view, commands)  ⇒ SchedulerInterruptListener 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of SchedulerInterruptListener. 
- #interrupt ⇒ Object
- #last_action_was_exit? ⇒ Boolean
- #last_action_was_resume? ⇒ Boolean
Constructor Details
#initialize(view, commands) ⇒ SchedulerInterruptListener
Returns a new instance of SchedulerInterruptListener.
| 3 4 5 6 7 8 | # File 'lib/run/scheduler_interrupt_listener.rb', line 3 def initialize view, commands @view = view @commands = commands @continue_after_command = false @last_action = "" end | 
Instance Method Details
#continue? ⇒ Boolean
| 26 27 28 | # File 'lib/run/scheduler_interrupt_listener.rb', line 26 def continue? @last_action == '' or last_action_was_resume? or @continue_after_command end | 
#interrupt ⇒ Object
| 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # File 'lib/run/scheduler_interrupt_listener.rb', line 10 def interrupt @continue_after_command = false @view. @last_action = @view.read_user_input.downcase @commands.each do |command| if @last_action.start_with? command.command_key command.execute @continue_after_command = command.continue_test_loop? end end if last_action_was_exit? then @view.show_kata_upload_hint end continue? end | 
#last_action_was_exit? ⇒ Boolean
| 34 35 36 | # File 'lib/run/scheduler_interrupt_listener.rb', line 34 def last_action_was_exit? @last_action.start_with? 'e' end | 
#last_action_was_resume? ⇒ Boolean
| 30 31 32 | # File 'lib/run/scheduler_interrupt_listener.rb', line 30 def last_action_was_resume? @last_action.start_with? 'r' end |