Class: Nova::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/nova/shell.rb

Constant Summary collapse

IRB_PROMPT =
{
  :AUTO_INDENT => true,
  :PROMPT_I    => "nova[%03n] >> ",
  :PROMPT_S    => "nova[%03n] %l> ",
  :PROMPT_C    => "nova[%03n] %i> ",
  :RETURN      => "nova <- %s\n"
}

Instance Method Summary collapse

Instance Method Details

#start_shellObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/nova/shell.rb', line 14

def start_shell
  IRB.setup __FILE__
  IRB.conf[:PROMPT][:NOVA_PROMPT] = IRB_PROMPT
  IRB.conf[:PROMPT_MODE] = :NOVA_PROMPT
  irb = IRB::Irb.new(IRB::WorkSpace.new(binding))

  IRB.conf[:MAIN_CONTEXT] = irb.context

  trap("SIGINT") { irb.signal_handle }

  begin
    catch(:IRB_EXIT) { irb.eval_input }
  ensure
    IRB.irb_at_exit
  end
end