Module: IRBerize
- Defined in:
- lib/irberize.rb
Class Method Summary collapse
Class Method Details
.run(s) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/irberize.rb', line 5 def self.run(s) # the following code closely resembles IRB.start IRB.setup(__FILE__) irb = IRB::Irb.new IRB.conf[:IRB_RC] = proc do |conf| eval s, conf.workspace.binding IRB.conf.delete(:IRB_RC) end IRB.conf[:IRB_RC].call(irb.context) IRB.conf[:MAIN_CONTEXT] = irb.context trap("SIGINT") do irb.signal_handle end catch(:IRB_EXIT) do irb.eval_input end end |