lib/tailog/ext/irb.rb in tailog-0.5.2 vs lib/tailog/ext/irb.rb in tailog-0.5.4
- old
+ new
@@ -4,9 +4,16 @@
def IRB.Output
IRB.conf[:OUTPUT]
end
+def IRB.evaluate_string string
+ irb = IRB::Irb.new nil, StringInputMethod.new(string + "\n")
+ IRB.conf[:MAIN_CONTEXT] = irb.context
+ IRB.conf[:OUTPUT] = []
+ irb.eval_input
+end
+
class IRB::WorkSpace
def evaluate(context, statements, file = __FILE__, line = __LINE__)
@after_ruby_debug_erb = false
eval(statements, @binding, file, line)
end