pry-stack_explorer 0.2.1pre1 → 0.2.2pre1

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,6 +38,7 @@ module PryStackExplorer
38
38
  n
39
39
  end
40
40
  end
41
+ private :convert_from_one_index
41
42
 
42
43
  def change_binding_to(index, pry_instance)
43
44
  index = convert_from_one_index(index)
@@ -89,7 +90,7 @@ module PryStackExplorer
89
90
  end
90
91
  end
91
92
 
92
- Pry.config.hooks.add_hook(:when_started) do |target|
93
+ Pry.config.hooks.add_hook(:when_started, :save_caller_bindings) do |target|
93
94
  if binding.of_caller(4).eval('__method__') == :pry
94
95
  drop_number = 5
95
96
  else
@@ -109,42 +110,11 @@ Pry.config.hooks.add_hook(:when_started) do |target|
109
110
  PryStackExplorer.frame_manager = PryStackExplorer::FrameManager.new(bindings)
110
111
  end
111
112
 
112
- # class << Pry
113
- # alias_method :PSE_old_start, :start
114
- # def start(target, *args, &block)
115
- # target = Pry.binding_for(target)
116
-
117
- # # we need to know how many frames to skip depending on whether we
118
- # # were invoked with Pry.start or Object#pry
119
- # if binding.of_caller(1).eval('__method__') == :pry
120
- # drop_number = 2
121
- # else
122
- # drop_number = 1
123
- # end
124
-
125
- # bindings = binding.callers.drop(drop_number)
126
-
127
- # # Use the binding returned by #of_caller if possible (as we get
128
- # # access to frame_type).
129
- # # Otherwise stick to the given binding (target).
130
- # if !PryStackExplorer.bindings_equal?(target, bindings.first)
131
- # bindings.shift
132
- # bindings.unshift(target)
133
- # end
134
-
135
- # PryStackExplorer.frame_manager = PryStackExplorer::FrameManager.new(bindings)
136
-
137
- # PSE_old_start(bindings.first, *args, &block)
138
- # end
139
- # end
140
-
141
113
  Pry.config.commands.import PryStackExplorer::StackCommands
142
114
 
143
- Pry.config.commands.alias_command "__old_whereami__", "whereami", ""
144
-
145
115
  # monkey-patch the whereami command to show some frame information,
146
116
  # useful for navigating stack.
147
- Pry.config.commands.command "whereami", "Show the code context for the session. (whereami <n> shows <n> extra lines of code around the invocation line. Default: 5)" do |num|
117
+ Pry.config.commands.before_command("whereami") do |num|
148
118
  if PryStackExplorer.frame_manager
149
119
  bindings = PryStackExplorer.frame_manager.bindings
150
120
  binding_index = PryStackExplorer.frame_manager.binding_index
@@ -153,6 +123,4 @@ Pry.config.commands.command "whereami", "Show the code context for the session.
153
123
  output.puts "#{Pry::Helpers::Text.bold('Frame number:')} #{binding_index + 1}/#{bindings.size}"
154
124
  output.puts "#{Pry::Helpers::Text.bold('Frame type:')} #{bindings[binding_index].frame_type}" rescue nil
155
125
  end
156
-
157
- run "__old_whereami__", num
158
126
  end
@@ -1,3 +1,3 @@
1
1
  module PryStackExplorer
2
- VERSION = "0.2.1pre1"
2
+ VERSION = "0.2.2pre1"
3
3
  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.1pre1
4
+ version: 0.2.2pre1
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-13 00:00:00.000000000 Z
12
+ date: 2011-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: binding_of_caller
16
- requirement: &70296103138940 !ruby/object:Gem::Requirement
16
+ requirement: &70175500731400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.5.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70296103138940
24
+ version_requirements: *70175500731400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bacon
27
- requirement: &70296103138400 !ruby/object:Gem::Requirement
27
+ requirement: &70175500730760 !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: *70296103138400
35
+ version_requirements: *70175500730760
36
36
  description: Walk the stack in a Pry session
37
37
  email: jrmair@gmail.com
38
38
  executables: []