pry-stack_explorer 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module PryStackExplorer
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "pry-stack_explorer"
5
- s.version = "0.3.6"
5
+ s.version = "0.3.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Mair (banisterfiend)"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: pry-stack_explorer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.6
5
+ version: 0.3.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Mair (banisterfiend)