Sha256: b2bdaf213765b7ea05ec55a06da67f2118fdecf53678cb68396e70ad9211ac0c

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true

# http://jasonroelofs.com/2009/04/02/embedding-irb-into-your-ruby-application/
require 'irb'

module IRB # :nodoc:
  def self.start_session(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)
    @CONF[:MAIN_CONTEXT] = irb.context

    catch(:IRB_EXIT) do
      irb.eval_input
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ki-0.4.12 lib/ki/utils/extra_irb.rb