Method: CDK::ExitConditions#setExitType

Defined in:
lib/cdk/mixins/exit_conditions.rb

#setExitType(ch) ⇒ Object

Set the object’s exit-type based on the input. The .exitType field should have been part of the CDKOBJS struct, but it is used too pervasively in older applications to move (yet).



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cdk/mixins/exit_conditions.rb', line 13

def setExitType(ch)
  case ch
  when CDK::KEY_ESC
    @exit_type = :ESCAPE_HIT
  when CDK::KEY_TAB, Ncurses::KEY_ENTER, CDK::KEY_RETURN
    @exit_type = :NORMAL
  when Ncurses::ERR
    @exit_type = :TIMEOUT
  when 0
    @exit_type = :EARLY_EXIT
  end
end