Class: Pry::Shell::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/pry/shell/session.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, host, port, with_byebug) ⇒ Session

Returns a new instance of Session.



21
22
23
24
25
26
# File 'lib/pry/shell/session.rb', line 21

def initialize(object, host, port, with_byebug)
  @object = object
  @host = host
  @port = port
  @with_byebug = with_byebug
end

Class Method Details

.run(object, host:, port:, with_byebug:) ⇒ Object



16
17
18
# File 'lib/pry/shell/session.rb', line 16

def run(object, host:, port:, with_byebug:)
  new(object, host, port, with_byebug).run
end

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/pry/shell/session.rb', line 28

def run
  Shell.active_shell_options = pry_options

  Pry.start(object, pry_options)
rescue DRb::DRbConnError
  puts "DRb connection failed!"
ensure
  # Since we run `Byebug.current_context.step_out` this ensure
  # block already runs and clears the options which are necessary
  # to setup the Byebug.
  # We are clearing this options in `PryShellProcessor` to ensure
  # they do not leak.
  unless enable_byebug?
    pry_options[:remove_connection].call

    Shell.clear_shell_options!
  end
end