pry-stack_explorer 0.3.6 → 0.3.7
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.
@@ -147,6 +147,7 @@ module PryStackExplorer
|
|
147
147
|
opt.on :v, :verbose, "Include extra information."
|
148
148
|
opt.on :H, :head, "Display the first N stack frames (defaults to 10).", :optional => true, :as => Integer, :default => 10
|
149
149
|
opt.on :T, :tail, "Display the last N stack frames (defaults to 10).", :optional => true, :as => Integer, :default => 10
|
150
|
+
opt.on :c, :current, "Display N frames either side of current frame (default to 5).", :optional => true, :as => Integer, :default => 5
|
150
151
|
end
|
151
152
|
|
152
153
|
def memoized_info(index, b, verbose)
|
@@ -166,6 +167,7 @@ module PryStackExplorer
|
|
166
167
|
def selected_stack_frames
|
167
168
|
if opts.present?(:head)
|
168
169
|
[0, frame_manager.bindings[0..(opts[:head] - 1)]]
|
170
|
+
|
169
171
|
elsif opts.present?(:tail)
|
170
172
|
tail = opts[:tail]
|
171
173
|
if tail > frame_manager.bindings.size
|
@@ -174,6 +176,13 @@ module PryStackExplorer
|
|
174
176
|
|
175
177
|
base_frame_index = frame_manager.bindings.size - tail
|
176
178
|
[base_frame_index, frame_manager.bindings[base_frame_index..-1]]
|
179
|
+
|
180
|
+
elsif opts.present?(:current)
|
181
|
+
first_frame_index = frame_manager.binding_index - (opts[:current])
|
182
|
+
first_frame_index = 0 if first_frame_index < 0
|
183
|
+
last_frame_index = frame_manager.binding_index + (opts[:current])
|
184
|
+
[first_frame_index, frame_manager.bindings[first_frame_index..last_frame_index]]
|
185
|
+
|
177
186
|
else
|
178
187
|
[0, frame_manager.bindings]
|
179
188
|
end
|
data/pry-stack_explorer.gemspec
CHANGED