Module: IRB
- Defined in:
- waxx/irb.rb
Overview
Jump into an IRB session with `waxx console`
Class Method Summary collapse
-
.start_session(context) ⇒ Object
Start an IRB session `waxx console`.
-
.start_session_old(binding) ⇒ Object
Start an IRB session for Ruby < 2.4.
Class Method Details
.start_session(context) ⇒ Object
Start an IRB session `waxx console`
36 37 38 39 40 41 42 43 |
# File 'waxx/irb.rb', line 36 def self.start_session(context) return self.start_session_old(context) if RUBY_VERSION.to_f < 2.4 IRB.setup(nil) workspace = IRB::WorkSpace.new(context) irb = IRB::Irb.new(workspace) IRB.conf[:MAIN_CONTEXT] = irb.context irb.eval_input end |
.start_session_old(binding) ⇒ Object
Start an IRB session for Ruby < 2.4
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'waxx/irb.rb', line 12 def self.start_session_old(binding) unless @__initialized args = ARGV ARGV.replace(ARGV.dup) IRB.setup(nil) ARGV.replace(args) @__initialized = true end workspace = WorkSpace.new(binding) irb = Irb.new(workspace) @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC] @CONF[:MAIN_CONTEXT] = irb.context catch(:IRB_EXIT) do irb.eval_input end end |