Class: Pry::REPL

Inherits:
Object show all
Extended by:
Forwardable
Defined in:
lib/pry/repl.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pry, options = {}) ⇒ REPL

Create an instance of Pry::REPL wrapping the given Pry.

Options Hash (options):

  • :target (Object)

    The initial target of the session.


22
23
24
25
26
27
28
29
# 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

Instance Attribute Details

#pryPry


9
10
11
# File 'lib/pry/repl.rb', line 9

def pry
  @pry
end

Class Method Details

.start(options) ⇒ Object

Instantiate a new Pry instance with the given options, then start a Pry::REPL instance wrapping it.

Options Hash (options):


14
15
16
# File 'lib/pry/repl.rb', line 14

def self.start(options)
  new(Pry.new(options)).start
end

Instance Method Details

#startObject?

Start the read-eval-print loop.

Raises:

  • (Exception)

    If the session throws `:raise_up`, raise the exception thrown with it.


36
37
38
39
40
41
# File 'lib/pry/repl.rb', line 36

def start
  prologue
  Pry::InputLock.for(:all).with_ownership { repl }
ensure
  epilogue
end