lib/tailog/ext/irb.rb in tailog-0.6.8 vs lib/tailog/ext/irb.rb in tailog-0.6.9
- old
+ new
@@ -1,10 +1,8 @@
require 'irb'
IRB.init_config nil
-IRB.conf[:PROMPT_MODE] = :DEFAULT
-IRB.conf[:VERBOSE] = false
class << IRB
def Output
conf[:OUTPUT]
end
@@ -12,12 +10,16 @@
def evaluate_string string
conf[:PROMPT_MODE] = :DEFAULT
conf[:VERBOSE] = false
conf[:OUTPUT] = []
- irb = Irb.new nil, StringInputMethod.new(string + "\n")
+ irb = IRB::Irb.new nil, StringInputMethod.new(string + "\nexit\n")
conf[:MAIN_CONTEXT] = irb.context
irb.eval_input
+
+ result = conf[:OUTPUT]
+ conf[:OUTPUT] = nil
+ result
end
alias_method :raw_irb_exit, :irb_exit
def irb_exit irb, ret