Class: PryMoves::PryWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/pry-moves/pry_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(binding_, pry_start_options, pry) ⇒ PryWrapper

Returns a new instance of PryWrapper.



5
6
7
8
9
# File 'lib/pry-moves/pry_wrapper.rb', line 5

def initialize(binding_, pry_start_options, pry)
  @init_binding = binding_
  @pry_start_options = pry_start_options   # Options to use for Pry.start
  @pry = pry
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pry-moves/pry_wrapper.rb', line 11

def run
  PryMoves.lock

  initial_frame = PryMoves::BindingsStack.new(@pry_start_options).initial_frame
  if not @pry_start_options[:pry_moves_loop] and initial_frame and
      initial_frame.local_variable_defined? :debug_redirect
    debug_redirect = initial_frame.local_variable_get(:debug_redirect)
    PryMoves.messages << "⏩ redirected to #{debug_redirect}"
    @command = {action: :step, binding: initial_frame}
  else
    start_pry
  end

  if @command
    trace_command
  else
    PryMoves.unlock
    if @pry_start_options[:pry_remote] && PryMoves.current_remote_server
      PryMoves.current_remote_server.teardown
    end
  end

  @return_value
end