Sha256: ac4a9c7c883a85e9a8187249cd032d7172c654b92a6133b9cda5dfc5d927a340

Contents?: true

Size: 897 Bytes

Versions: 8

Compression:

Stored size: 897 Bytes

Contents

require 'binding_of_caller'

class Binding
  def _irb(_host=nil)
    warn 'loading irb ...'

    if defined? Break and defined? IRB
      # This is need for work with looksee better.
      # See discuss on https://github.com/oggy/looksee/issues/57
      IRB.conf[:USE_COLORIZE] = false
    else
      warn "For work with Break and Looksee, please set
export RUBYOPT='-rpryx_irb'
instead of
export RUBYOPT='-rpryx'
"
    end

    self.irb
  end
end

module Kernel
  def irb!
    return unless ENV['IRB_was_started'].nil?

    ENV['IRB_was_started'] = 'true'

    binding.of_caller(1)._irb
  end

  def reirb!
    ENV['IRB_was_started'] = nil
  end

  def irb1
    ENV['IRB2_should_start'] = 'true'
  end

  def irb2(caller=1, remote: nil, port: 9876)
    if ENV['IRB2_should_start'] == 'true'
      ENV['IRB2_should_start'] = nil
      binding.of_caller(caller)._irb
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pryx-0.5.0 lib/pryx/irb_hack.rb
pryx-0.4.4 lib/pryx/irb_hack.rb
pryx-0.4.3 lib/pryx/irb_hack.rb
pryx-0.4.2 lib/pryx/irb_hack.rb
pryx-0.4.1 lib/pryx/irb_hack.rb
pryx-0.4.0 lib/pryx/irb_hack.rb
pryx-0.3.1 lib/pryx/irb_hack.rb
pryx-0.3.0 lib/pryx/irb_hack.rb