class Pry::REPL

Attributes

pry[RW]

@return [Pry] The instance of {Pry} that the user is controlling.

Public Class Methods

new(pry, options = {}) click to toggle source

Create an instance of {REPL} wrapping the given {Pry}. @param [Pry] pry The instance of {Pry} that this {REPL} will control. @param [Hash] options Options for this {REPL} instance. @option options [Object] :target The initial target of the session.

# File lib/pry/repl.rb, line 22
def initialize(pry, options = {})
  @pry    = pry
  @indent = Pry::Indent.new

  if options[:target]
    @pry.push_binding options[:target]
  end
end
start(options) click to toggle source

Instantiate a new {Pry} instance with the given options, then start a {REPL} instance wrapping it. @option options See {Pry#initialize}

# File lib/pry/repl.rb, line 14
def self.start(options)
  new(Pry.new(options)).start
end

Public Instance Methods

start() click to toggle source

Start the read-eval-print loop. @return [Object?] If the session throws `:breakout`, return the value

thrown with it.

@raise [Exception] If the session throws `:raise_up`, raise the exception

thrown with it.
# File lib/pry/repl.rb, line 36
def start
  prologue
  Pry::InputLock.for(:all).with_ownership { repl }
ensure
  epilogue
end