Skip to content

Commit

Permalink
added frame and frame-type commands to ease navigation, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
banister committed Nov 4, 2011
1 parent efc9410 commit af879ff
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions lib/pry_time/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@
inc = inc_str.nil? ? 1 : inc_str.to_i

PryTime.data[:instance].binding_index += inc
_pry_.run_command "whereami"
end

command "down", "Go down to the callee's context" do |inc_str|
inc = inc_str.nil? ? 1 : inc_str.to_i

PryTime.data[:instance].binding_index -= inc
_pry_.run_command "whereami"
end

command "frame", "Switch to a particular frame" do |frame_num|
PryTime.data[:instance].binding_index = frame_num.to_i
end

command "frame-type", "Display current frame type." do
bindex = PryTime.data[:instance].binding_index
output.puts PryTime.data[:instance].exception_bindings[bindex].frame_type
end

command "bt", "Show the full backtrace for the current exception" do
Expand All @@ -26,17 +33,4 @@
PryTime.data[:instance].current_exception.continue
end
end

helpers do
def update_current_binding(current_binding)
if current_binding
output.puts "Can't locate source for eval'd code" if current_binding.eval("__FILE__") == "(eval)"

PryTime.data[:instance].binding_stack[-1] = current_binding
PryTime.data[:instance].run_command "whereami"
else
output.puts "Reached end of stacktrace, go back down the stack by typing down"
end
end
end
end

0 comments on commit af879ff

Please sign in to comment.