Sha256: 9d1650028774b25ff2c16c55a63243d63c116b3ec942396e9a58422e83b1de53

Contents?: true

Size: 679 Bytes

Versions: 2

Compression:

Stored size: 679 Bytes

Contents

# encoding: utf-8

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)

    @CONF[:PROMPT][:CARBON] = {
      :PROMPT_I => "%m> ",
      :PROMPT_S => "%m\"> ",
      :PROMPT_C => "%m…>",
      :PROMPT_N => "%m→>",
      :RETURN => ''
    }
    @CONF[:PROMPT_MODE] = :CARBON

    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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
carbon-1.0.4 lib/carbon/cli/irb.rb
carbon-1.0.3 lib/carbon/cli/irb.rb