Class: XMP
Defined Under Namespace
Classes: StringInputMethod
Instance Method Summary collapse
-
#initialize(bind = nil) ⇒ XMP
constructor
A new instance of XMP.
- #puts(exps) ⇒ Object
Constructor Details
#initialize(bind = nil) ⇒ XMP
Returns a new instance of XMP.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/irb/xmp.rb', line 18 def initialize(bind = nil) IRB.init_config(nil) #IRB.parse_opts #IRB.load_modules IRB.conf[:PROMPT_MODE] = :XMP bind = IRB::Frame.top(1) unless bind ws = IRB::WorkSpace.new(bind) @io = StringInputMethod.new @irb = IRB::Irb.new(ws, @io) @irb.context.ignore_sigint = false # IRB.conf[:IRB_RC].call(@irb.context) if IRB.conf[:IRB_RC] IRB.conf[:MAIN_CONTEXT] = @irb.context end |
Instance Method Details
#puts(exps) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/irb/xmp.rb', line 35 def puts(exps) @io.puts exps if @irb.context.ignore_sigint begin trap_proc_b = trap("SIGINT"){@irb.signal_handle} catch(:IRB_EXIT) do @irb.eval_input end ensure trap("SIGINT", trap_proc_b) end else catch(:IRB_EXIT) do @irb.eval_input end end end |