Class | XMP |
In: |
lib/irb/xmp.rb
|
Parent: | Object |
# File lib/irb/xmp.rb, line 19 19: def initialize(bind = nil) 20: IRB.init_config(nil) 21: #IRB.parse_opts 22: #IRB.load_modules 23: 24: IRB.conf[:PROMPT_MODE] = :XMP 25: 26: bind = IRB::Frame.top(1) unless bind 27: ws = IRB::WorkSpace.new(bind) 28: @io = StringInputMethod.new 29: @irb = IRB::Irb.new(ws, @io) 30: @irb.context.ignore_sigint = false 31: 32: # IRB.conf[:IRB_RC].call(@irb.context) if IRB.conf[:IRB_RC] 33: IRB.conf[:MAIN_CONTEXT] = @irb.context 34: end
# File lib/irb/xmp.rb, line 36 36: def puts(exps) 37: @io.puts exps 38: 39: if @irb.context.ignore_sigint 40: begin 41: trap_proc_b = trap("SIGINT"){@irb.signal_handle} 42: catch(:IRB_EXIT) do 43: @irb.eval_input 44: end 45: ensure 46: trap("SIGINT", trap_proc_b) 47: end 48: else 49: catch(:IRB_EXIT) do 50: @irb.eval_input 51: end 52: end 53: end