pry-stack_explorer 0.2.8pre1 → 0.2.8pre3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module PryStackExplorer
|
|
2
2
|
StackCommands = Pry::CommandSet.new do
|
|
3
|
-
command "up", "Go up to the caller's context" do |inc_str|
|
|
3
|
+
command "up", "Go up to the caller's context. Accepts optional numeric parameter for how many frames to move up." do |inc_str|
|
|
4
4
|
inc = inc_str.nil? ? 1 : inc_str.to_i
|
|
5
5
|
|
|
6
6
|
if !PryStackExplorer.frame_manager(_pry_)
|
|
@@ -11,14 +11,18 @@ module PryStackExplorer
|
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
command "down", "Go down to the callee's context." do |inc_str|
|
|
14
|
+
command "down", "Go down to the callee's context. Accepts optional numeric parameter for how many frames to move down." do |inc_str|
|
|
15
15
|
inc = inc_str.nil? ? 1 : inc_str.to_i
|
|
16
16
|
|
|
17
17
|
if !PryStackExplorer.frame_manager(_pry_)
|
|
18
18
|
output.puts "Nowhere to go!"
|
|
19
19
|
else
|
|
20
20
|
binding_index = PryStackExplorer.frame_manager(_pry_).binding_index
|
|
21
|
-
|
|
21
|
+
if binding_index - inc < 0
|
|
22
|
+
output.puts "Warning: At bottom of stack, cannot go further!"
|
|
23
|
+
else
|
|
24
|
+
PryStackExplorer.frame_manager(_pry_).change_frame_to binding_index - inc
|
|
25
|
+
end
|
|
22
26
|
end
|
|
23
27
|
end
|
|
24
28
|
|
|
@@ -36,19 +40,22 @@ module PryStackExplorer
|
|
|
36
40
|
if !PryStackExplorer.frame_manager(_pry_)
|
|
37
41
|
output.puts "No caller stack available!"
|
|
38
42
|
else
|
|
39
|
-
|
|
43
|
+
content = ""
|
|
44
|
+
content << "\n#{text.bold('Showing all accessible frames in stack:')}\n--\n"
|
|
40
45
|
|
|
41
46
|
PryStackExplorer.frame_manager(_pry_).each_with_index do |b, i|
|
|
42
47
|
if i == PryStackExplorer.frame_manager(_pry_).binding_index
|
|
43
|
-
|
|
48
|
+
content << "=> ##{i} #{frame_info(b, opts[:v])}\n"
|
|
44
49
|
else
|
|
45
|
-
|
|
50
|
+
content << " ##{i} #{frame_info(b, opts[:v])}\n"
|
|
46
51
|
end
|
|
47
52
|
end
|
|
53
|
+
|
|
54
|
+
stagger_output content
|
|
48
55
|
end
|
|
49
56
|
end
|
|
50
57
|
|
|
51
|
-
command "frame", "Switch to a particular frame." do |frame_num|
|
|
58
|
+
command "frame", "Switch to a particular frame. Accepts numeric parameter for the target frame to switch to (use with show-stack). Negative frame numbers allowed." do |frame_num|
|
|
52
59
|
if !PryStackExplorer.frame_manager(_pry_)
|
|
53
60
|
output.puts "nowhere to go!"
|
|
54
61
|
else
|
|
@@ -70,12 +77,12 @@ module PryStackExplorer
|
|
|
70
77
|
b_self = b.eval('self')
|
|
71
78
|
meth_obj = Pry::Method.new(b_self.method(meth)) if meth
|
|
72
79
|
|
|
73
|
-
type = b.frame_type ? "(#{b.frame_type})"
|
|
80
|
+
type = b.frame_type ? "(#{b.frame_type})" : ""
|
|
74
81
|
desc = b.frame_description ? "#{text.bold('Description:')} #{b.frame_description}".ljust(60) :
|
|
75
82
|
"#{text.bold('Description:')} #{PryStackExplorer.frame_manager(_pry_).frame_info_for(b)}".ljust(60)
|
|
76
83
|
sig = meth ? "#{text.bold('Signature:')} #{se_signature_with_owner(meth_obj)}".ljust(40) : "".ljust(32)
|
|
77
84
|
|
|
78
|
-
slf_class = "#{text.bold('Self.class:')} #{b_self.class}".ljust(
|
|
85
|
+
slf_class = "#{text.bold('Self.class:')} #{b_self.class}".ljust(40)
|
|
79
86
|
path = "#{text.bold("@ File:")} #{b.eval('__FILE__')}:#{b.eval('__LINE__')}"
|
|
80
87
|
|
|
81
88
|
"#{desc} #{slf_class} #{sig} #{type} #{path if verbose}"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module PryStackExplorer
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
class FrameManager
|
|
4
4
|
include Enumerable
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
attr_accessor :binding_index
|
|
7
7
|
attr_accessor :bindings
|
|
8
8
|
|
|
@@ -42,7 +42,7 @@ module PryStackExplorer
|
|
|
42
42
|
# Ensure the Pry instance's active binding is the frame manager's
|
|
43
43
|
# active binding.
|
|
44
44
|
def refresh_frame
|
|
45
|
-
change_frame_to binding_index
|
|
45
|
+
change_frame_to binding_index
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# @return [Binding] The currently active frame
|
|
@@ -57,15 +57,18 @@ module PryStackExplorer
|
|
|
57
57
|
|
|
58
58
|
if index > bindings.size - 1
|
|
59
59
|
@pry.output.puts "Warning: At top of stack, cannot go further!"
|
|
60
|
-
elsif index <
|
|
60
|
+
elsif index < -bindings.size
|
|
61
61
|
@pry.output.puts "Warning: At bottom of stack, cannot go further!"
|
|
62
62
|
else
|
|
63
|
+
# wrap around negative indices
|
|
64
|
+
index = (bindings.size - 1) + index + 1 if index < 0
|
|
65
|
+
|
|
63
66
|
self.binding_index = index
|
|
64
67
|
@pry.binding_stack[-1] = bindings[binding_index]
|
|
65
68
|
|
|
66
69
|
@pry.run_command "whereami"
|
|
67
70
|
end
|
|
68
71
|
end
|
|
69
|
-
|
|
72
|
+
|
|
70
73
|
end
|
|
71
74
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pry-stack_explorer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.8pre3
|
|
5
5
|
prerelease: 5
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -13,7 +13,7 @@ date: 2011-12-19 00:00:00.000000000 Z
|
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: binding_of_caller
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70151324507000 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: 0.6.1
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70151324507000
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: bacon
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &70151324504220 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ~>
|
|
@@ -32,7 +32,7 @@ dependencies:
|
|
|
32
32
|
version: 1.1.0
|
|
33
33
|
type: :development
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *70151324504220
|
|
36
36
|
description: Walk the stack in a Pry session
|
|
37
37
|
email: jrmair@gmail.com
|
|
38
38
|
executables: []
|