Module: Ripl::Em

Defined in:
lib/ripl/em.rb

Defined Under Namespace

Classes: KeyboardHandler

Constant Summary collapse

VERSION =
'0.1.0'

Instance Method Summary collapse

Instance Method Details

#before_loopObject



20
21
22
23
24
25
# File 'lib/ripl/em.rb', line 20

def before_loop
  super
  $stdout.sync = true
  Ripl::Shell::EXIT_WORDS << "\x00" # Ctrl-D + Enter exit
  trap("SIGINT") { handle_interrupt }
end

#get_inputObject



7
8
9
10
# File 'lib/ripl/em.rb', line 7

def get_input
  history << @input
  @input
end

#in_loopObject



12
13
14
15
16
17
18
# File 'lib/ripl/em.rb', line 12

def in_loop
  catch(:ripl_exit) {
    EM.run { EM.open_keyboard(KeyboardHandler) }
  }
rescue
  print_eval_error($!)
end