pry 0.12.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +162 -1
- data/LICENSE +1 -1
- data/README.md +331 -269
- data/bin/pry +5 -0
- data/lib/pry.rb +132 -119
- data/lib/pry/basic_object.rb +8 -4
- data/lib/pry/block_command.rb +22 -0
- data/lib/pry/class_command.rb +194 -0
- data/lib/pry/cli.rb +43 -51
- data/lib/pry/code.rb +40 -28
- data/lib/pry/code/code_file.rb +28 -24
- data/lib/pry/code/code_range.rb +4 -2
- data/lib/pry/code/loc.rb +15 -8
- data/lib/pry/code_object.rb +40 -38
- data/lib/pry/color_printer.rb +47 -46
- data/lib/pry/command.rb +166 -369
- data/lib/pry/command_set.rb +76 -73
- data/lib/pry/command_state.rb +31 -0
- data/lib/pry/commands/amend_line.rb +86 -81
- data/lib/pry/commands/bang.rb +18 -14
- data/lib/pry/commands/bang_pry.rb +15 -11
- data/lib/pry/commands/cat.rb +61 -54
- data/lib/pry/commands/cat/abstract_formatter.rb +23 -18
- data/lib/pry/commands/cat/exception_formatter.rb +71 -60
- data/lib/pry/commands/cat/file_formatter.rb +55 -49
- data/lib/pry/commands/cat/input_expression_formatter.rb +35 -30
- data/lib/pry/commands/cd.rb +40 -35
- data/lib/pry/commands/change_inspector.rb +29 -22
- data/lib/pry/commands/change_prompt.rb +44 -39
- data/lib/pry/commands/clear_screen.rb +16 -10
- data/lib/pry/commands/code_collector.rb +148 -133
- data/lib/pry/commands/disable_pry.rb +23 -19
- data/lib/pry/commands/easter_eggs.rb +19 -30
- data/lib/pry/commands/edit.rb +184 -161
- data/lib/pry/commands/edit/exception_patcher.rb +21 -17
- data/lib/pry/commands/edit/file_and_line_locator.rb +34 -23
- data/lib/pry/commands/exit.rb +39 -35
- data/lib/pry/commands/exit_all.rb +24 -20
- data/lib/pry/commands/exit_program.rb +20 -16
- data/lib/pry/commands/find_method.rb +168 -160
- data/lib/pry/commands/fix_indent.rb +16 -12
- data/lib/pry/commands/help.rb +140 -133
- data/lib/pry/commands/hist.rb +151 -150
- data/lib/pry/commands/import_set.rb +20 -16
- data/lib/pry/commands/jump_to.rb +25 -21
- data/lib/pry/commands/list_inspectors.rb +35 -28
- data/lib/pry/commands/ls.rb +124 -102
- data/lib/pry/commands/ls/constants.rb +59 -42
- data/lib/pry/commands/ls/formatter.rb +50 -46
- data/lib/pry/commands/ls/globals.rb +38 -34
- data/lib/pry/commands/ls/grep.rb +17 -13
- data/lib/pry/commands/ls/instance_vars.rb +29 -27
- data/lib/pry/commands/ls/interrogatable.rb +18 -12
- data/lib/pry/commands/ls/jruby_hacks.rb +47 -41
- data/lib/pry/commands/ls/local_names.rb +26 -22
- data/lib/pry/commands/ls/local_vars.rb +38 -28
- data/lib/pry/commands/ls/ls_entity.rb +47 -51
- data/lib/pry/commands/ls/methods.rb +44 -43
- data/lib/pry/commands/ls/methods_helper.rb +46 -42
- data/lib/pry/commands/ls/self_methods.rb +23 -22
- data/lib/pry/commands/nesting.rb +21 -17
- data/lib/pry/commands/play.rb +93 -82
- data/lib/pry/commands/pry_backtrace.rb +22 -17
- data/lib/pry/commands/pry_version.rb +15 -11
- data/lib/pry/commands/raise_up.rb +27 -22
- data/lib/pry/commands/reload_code.rb +60 -48
- data/lib/pry/commands/reset.rb +16 -12
- data/lib/pry/commands/ri.rb +55 -45
- data/lib/pry/commands/save_file.rb +45 -43
- data/lib/pry/commands/shell_command.rb +51 -51
- data/lib/pry/commands/shell_mode.rb +21 -17
- data/lib/pry/commands/show_doc.rb +80 -68
- data/lib/pry/commands/show_info.rb +189 -171
- data/lib/pry/commands/show_input.rb +16 -11
- data/lib/pry/commands/show_source.rb +110 -45
- data/lib/pry/commands/stat.rb +35 -31
- data/lib/pry/commands/switch_to.rb +21 -15
- data/lib/pry/commands/toggle_color.rb +20 -16
- data/lib/pry/commands/watch_expression.rb +89 -86
- data/lib/pry/commands/watch_expression/expression.rb +32 -27
- data/lib/pry/commands/whereami.rb +156 -148
- data/lib/pry/commands/wtf.rb +75 -50
- data/lib/pry/config.rb +307 -25
- data/lib/pry/config/attributable.rb +22 -0
- data/lib/pry/config/lazy_value.rb +29 -0
- data/lib/pry/config/memoized_value.rb +34 -0
- data/lib/pry/config/value.rb +24 -0
- data/lib/pry/control_d_handler.rb +28 -0
- data/lib/pry/core_extensions.rb +9 -7
- data/lib/pry/editor.rb +48 -21
- data/lib/pry/env.rb +18 -0
- data/lib/pry/exception_handler.rb +43 -0
- data/lib/pry/exceptions.rb +13 -16
- data/lib/pry/forwardable.rb +5 -1
- data/lib/pry/helpers.rb +2 -0
- data/lib/pry/helpers/base_helpers.rb +68 -197
- data/lib/pry/helpers/command_helpers.rb +50 -61
- data/lib/pry/helpers/documentation_helpers.rb +20 -13
- data/lib/pry/helpers/options_helpers.rb +14 -7
- data/lib/pry/helpers/platform.rb +7 -5
- data/lib/pry/helpers/table.rb +33 -26
- data/lib/pry/helpers/text.rb +17 -14
- data/lib/pry/history.rb +48 -56
- data/lib/pry/hooks.rb +21 -12
- data/lib/pry/indent.rb +54 -50
- data/lib/pry/input_completer.rb +248 -230
- data/lib/pry/input_lock.rb +8 -9
- data/lib/pry/inspector.rb +36 -24
- data/lib/pry/last_exception.rb +45 -45
- data/lib/pry/method.rb +141 -94
- data/lib/pry/method/disowned.rb +16 -4
- data/lib/pry/method/patcher.rb +12 -3
- data/lib/pry/method/weird_method_locator.rb +68 -44
- data/lib/pry/object_path.rb +33 -25
- data/lib/pry/output.rb +121 -35
- data/lib/pry/pager.rb +186 -180
- data/lib/pry/prompt.rb +123 -54
- data/lib/pry/pry_class.rb +61 -103
- data/lib/pry/pry_instance.rb +217 -215
- data/lib/pry/repl.rb +18 -22
- data/lib/pry/repl_file_loader.rb +27 -21
- data/lib/pry/ring.rb +11 -6
- data/lib/pry/slop.rb +574 -563
- data/lib/pry/slop/commands.rb +164 -169
- data/lib/pry/slop/option.rb +172 -168
- data/lib/pry/syntax_highlighter.rb +26 -0
- data/lib/pry/system_command_handler.rb +17 -0
- data/lib/pry/testable.rb +59 -61
- data/lib/pry/testable/evalable.rb +21 -12
- data/lib/pry/testable/mockable.rb +18 -10
- data/lib/pry/testable/pry_tester.rb +71 -56
- data/lib/pry/testable/utility.rb +29 -21
- data/lib/pry/testable/variables.rb +49 -43
- data/lib/pry/version.rb +3 -1
- data/lib/pry/warning.rb +27 -0
- data/lib/pry/wrapped_module.rb +51 -42
- data/lib/pry/wrapped_module/candidate.rb +21 -14
- metadata +35 -35
- data/lib/pry/commands.rb +0 -6
- data/lib/pry/commands/disabled_commands.rb +0 -2
- data/lib/pry/commands/gem_cd.rb +0 -26
- data/lib/pry/commands/gem_install.rb +0 -32
- data/lib/pry/commands/gem_list.rb +0 -33
- data/lib/pry/commands/gem_open.rb +0 -29
- data/lib/pry/commands/gem_readme.rb +0 -25
- data/lib/pry/commands/gem_search.rb +0 -40
- data/lib/pry/commands/gem_stats.rb +0 -83
- data/lib/pry/commands/gist.rb +0 -102
- data/lib/pry/commands/install_command.rb +0 -54
- data/lib/pry/config/behavior.rb +0 -255
- data/lib/pry/config/convenience.rb +0 -28
- data/lib/pry/config/default.rb +0 -159
- data/lib/pry/config/memoization.rb +0 -48
- data/lib/pry/platform.rb +0 -91
- data/lib/pry/plugins.rb +0 -122
- data/lib/pry/rubygem.rb +0 -84
- data/lib/pry/terminal.rb +0 -91
@@ -1,36 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Pry
|
2
|
-
class Command
|
3
|
-
class
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
class Command
|
5
|
+
class Ls < Pry::ClassCommand
|
6
|
+
class LocalVars < Pry::Command::Ls::Formatter
|
7
|
+
def initialize(opts, pry_instance)
|
8
|
+
super(pry_instance)
|
9
|
+
@default_switch = opts[:locals]
|
10
|
+
@sticky_locals = pry_instance.sticky_locals
|
11
|
+
end
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
def output_self
|
14
|
+
locals = @target.eval('local_variables').reject do |e|
|
15
|
+
@sticky_locals.key?(e.to_sym)
|
16
|
+
end
|
17
|
+
name_value_pairs = locals.map do |name|
|
18
|
+
[name, @target.eval(name.to_s)]
|
19
|
+
end
|
20
|
+
format(name_value_pairs).join('')
|
21
|
+
end
|
18
22
|
|
19
|
-
|
23
|
+
private
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def format(name_value_pairs)
|
26
|
+
sorted = name_value_pairs.sort_by do |_name, value|
|
27
|
+
value.to_s.size
|
28
|
+
end
|
29
|
+
sorted.reverse.map do |name, value|
|
30
|
+
colorized_assignment_style(name, format_value(value))
|
31
|
+
end
|
32
|
+
end
|
28
33
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
+
def colorized_assignment_style(lhs, rhs, desired_width = 7)
|
35
|
+
colorized_lhs = color(:local_var, lhs)
|
36
|
+
color_escape_padding = colorized_lhs.size - lhs.size
|
37
|
+
pad = desired_width + color_escape_padding
|
38
|
+
Kernel.format(
|
39
|
+
"%-#{pad}<name>s = %<value>s",
|
40
|
+
name: color(:local_var, colorized_lhs),
|
41
|
+
value: rhs
|
42
|
+
)
|
43
|
+
end
|
34
44
|
end
|
35
45
|
end
|
36
46
|
end
|
@@ -1,68 +1,64 @@
|
|
1
|
-
|
2
|
-
require 'pry/commands/ls/formatter'
|
3
|
-
require 'pry/commands/ls/globals'
|
4
|
-
require 'pry/commands/ls/constants'
|
5
|
-
require 'pry/commands/ls/methods'
|
6
|
-
require 'pry/commands/ls/self_methods'
|
7
|
-
require 'pry/commands/ls/instance_vars'
|
8
|
-
require 'pry/commands/ls/local_names'
|
9
|
-
require 'pry/commands/ls/local_vars'
|
1
|
+
# frozen_string_literal: true
|
10
2
|
|
11
3
|
class Pry
|
12
|
-
class Command
|
13
|
-
class
|
14
|
-
|
4
|
+
class Command
|
5
|
+
class Ls < Pry::ClassCommand
|
6
|
+
class LsEntity
|
7
|
+
attr_reader :pry_instance
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
9
|
+
def initialize(opts)
|
10
|
+
@interrogatee = opts[:interrogatee]
|
11
|
+
@no_user_opts = opts[:no_user_opts]
|
12
|
+
@opts = opts[:opts]
|
13
|
+
@args = opts[:args]
|
14
|
+
@grep = Grep.new(Regexp.new(opts[:opts][:G] || '.'))
|
15
|
+
@pry_instance = opts.delete(:pry_instance)
|
16
|
+
end
|
24
17
|
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
def entities_table
|
19
|
+
entities.map(&:write_out).select { |o| o }.join('')
|
20
|
+
end
|
28
21
|
|
29
|
-
|
22
|
+
private
|
30
23
|
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
def grep(entity)
|
25
|
+
entity.tap { |o| o.grep = @grep }
|
26
|
+
end
|
34
27
|
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
def globals
|
29
|
+
grep Globals.new(@opts, pry_instance)
|
30
|
+
end
|
38
31
|
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
def constants
|
33
|
+
grep Constants.new(@interrogatee, @no_user_opts, @opts, pry_instance)
|
34
|
+
end
|
42
35
|
|
43
|
-
|
44
|
-
|
45
|
-
|
36
|
+
def methods
|
37
|
+
grep(Methods.new(@interrogatee, @no_user_opts, @opts, pry_instance))
|
38
|
+
end
|
46
39
|
|
47
|
-
|
48
|
-
|
49
|
-
|
40
|
+
def self_methods
|
41
|
+
grep SelfMethods.new(@interrogatee, @no_user_opts, @opts, pry_instance)
|
42
|
+
end
|
50
43
|
|
51
|
-
|
52
|
-
|
53
|
-
|
44
|
+
def instance_vars
|
45
|
+
grep InstanceVars.new(@interrogatee, @no_user_opts, @opts, pry_instance)
|
46
|
+
end
|
54
47
|
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
def local_names
|
49
|
+
grep LocalNames.new(@no_user_opts, @args, pry_instance)
|
50
|
+
end
|
58
51
|
|
59
|
-
|
60
|
-
|
61
|
-
|
52
|
+
def local_vars
|
53
|
+
LocalVars.new(@opts, pry_instance)
|
54
|
+
end
|
62
55
|
|
63
|
-
|
64
|
-
|
65
|
-
|
56
|
+
def entities
|
57
|
+
[
|
58
|
+
globals, constants, methods, self_methods, instance_vars, local_names,
|
59
|
+
local_vars
|
60
|
+
]
|
61
|
+
end
|
66
62
|
end
|
67
63
|
end
|
68
64
|
end
|
@@ -1,53 +1,54 @@
|
|
1
|
-
|
2
|
-
require 'pry/commands/ls/interrogatable'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
3
|
class Pry
|
5
|
-
class Command
|
6
|
-
class
|
7
|
-
|
8
|
-
|
4
|
+
class Command
|
5
|
+
class Ls < Pry::ClassCommand
|
6
|
+
class Methods < Pry::Command::Ls::Formatter
|
7
|
+
include Pry::Command::Ls::Interrogatable
|
8
|
+
include Pry::Command::Ls::MethodsHelper
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
def initialize(interrogatee, no_user_opts, opts, pry_instance)
|
11
|
+
super(pry_instance)
|
12
|
+
@interrogatee = interrogatee
|
13
|
+
@no_user_opts = no_user_opts
|
14
|
+
@default_switch = opts[:methods]
|
15
|
+
@instance_methods_switch = opts['instance-methods']
|
16
|
+
@ppp_switch = opts[:ppp]
|
17
|
+
@jruby_switch = opts['all-java']
|
18
|
+
@quiet_switch = opts[:quiet]
|
19
|
+
@verbose_switch = opts[:verbose]
|
20
|
+
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
def output_self
|
23
|
+
methods = all_methods.group_by(&:owner)
|
24
|
+
# Reverse the resolution order so that the most useful information
|
25
|
+
# appears right by the prompt.
|
26
|
+
resolution_order.take_while(&below_ceiling).reverse.map do |klass|
|
27
|
+
methods_here = (methods[klass] || []).select { |m| grep.regexp[m.name] }
|
28
|
+
heading = "#{Pry::WrappedModule.new(klass).method_prefix}methods"
|
29
|
+
output_section(heading, format(methods_here))
|
30
|
+
end.join('')
|
31
|
+
end
|
32
32
|
|
33
|
-
|
33
|
+
private
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
def correct_opts?
|
36
|
+
super || @instance_methods_switch || @ppp_switch || @no_user_opts
|
37
|
+
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
39
|
+
# Get a lambda that can be used with `take_while` to prevent over-eager
|
40
|
+
# traversal of the Object's ancestry graph.
|
41
|
+
def below_ceiling
|
42
|
+
ceiling = if @quiet_switch
|
43
|
+
[Pry::Method.safe_send(interrogatee_mod, :ancestors)[1]] +
|
44
|
+
pry_instance.config.ls.ceiling
|
45
|
+
elsif @verbose_switch
|
46
|
+
[]
|
47
|
+
else
|
48
|
+
pry_instance.config.ls.ceiling.dup
|
49
|
+
end
|
50
|
+
->(klass) { !ceiling.include?(klass) }
|
51
|
+
end
|
51
52
|
end
|
52
53
|
end
|
53
54
|
end
|
@@ -1,46 +1,50 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Pry
|
4
|
+
class Command
|
5
|
+
class Ls < Pry::ClassCommand
|
6
|
+
module MethodsHelper
|
7
|
+
include Pry::Command::Ls::JRubyHacks
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
# Get all the methods that we'll want to output.
|
12
|
+
def all_methods(instance_methods = false)
|
13
|
+
methods = if instance_methods || @instance_methods_switch
|
14
|
+
Pry::Method.all_from_class(@interrogatee)
|
15
|
+
else
|
16
|
+
Pry::Method.all_from_obj(@interrogatee)
|
17
|
+
end
|
18
|
+
|
19
|
+
if Pry::Helpers::Platform.jruby? && !@jruby_switch
|
20
|
+
methods = trim_jruby_aliases(methods)
|
21
|
+
end
|
22
|
+
|
23
|
+
methods.select { |method| @ppp_switch || method.visibility == :public }
|
24
|
+
end
|
25
|
+
|
26
|
+
def resolution_order
|
27
|
+
if @instance_methods_switch
|
28
|
+
Pry::Method.instance_resolution_order(@interrogatee)
|
29
|
+
else
|
30
|
+
Pry::Method.resolution_order(@interrogatee)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def format(methods)
|
35
|
+
methods.sort_by(&:name).map do |method|
|
36
|
+
if method.name == 'method_missing'
|
37
|
+
color(:method_missing, 'method_missing')
|
38
|
+
elsif method.visibility == :private
|
39
|
+
color(:private_method, method.name)
|
40
|
+
elsif method.visibility == :protected
|
41
|
+
color(:protected_method, method.name)
|
42
|
+
else
|
43
|
+
color(:public_method, method.name)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
42
47
|
end
|
43
48
|
end
|
44
49
|
end
|
45
|
-
|
46
50
|
end
|
@@ -1,32 +1,33 @@
|
|
1
|
-
|
2
|
-
require 'pry/commands/ls/methods_helper'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
3
|
class Pry
|
5
|
-
class Command
|
6
|
-
class
|
7
|
-
|
8
|
-
|
4
|
+
class Command
|
5
|
+
class Ls < Pry::ClassCommand
|
6
|
+
class SelfMethods < Pry::Command::Ls::Formatter
|
7
|
+
include Pry::Command::Ls::Interrogatable
|
8
|
+
include Pry::Command::Ls::MethodsHelper
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
def initialize(interrogatee, no_user_opts, opts, pry_instance)
|
11
|
+
super(pry_instance)
|
12
|
+
@interrogatee = interrogatee
|
13
|
+
@no_user_opts = no_user_opts
|
14
|
+
@ppp_switch = opts[:ppp]
|
15
|
+
@jruby_switch = opts['all-java']
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
def output_self
|
19
|
+
methods = all_methods(true).select do |m|
|
20
|
+
m.owner == @interrogatee && grep.regexp[m.name]
|
21
|
+
end
|
22
|
+
heading = "#{Pry::WrappedModule.new(@interrogatee).method_prefix}methods"
|
23
|
+
output_section(heading, format(methods))
|
21
24
|
end
|
22
|
-
heading = "#{ Pry::WrappedModule.new(@interrogatee).method_prefix }methods"
|
23
|
-
output_section(heading, format(methods))
|
24
|
-
end
|
25
25
|
|
26
|
-
|
26
|
+
private
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
def correct_opts?
|
29
|
+
@no_user_opts && interrogating_a_module?
|
30
|
+
end
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
data/lib/pry/commands/nesting.rb
CHANGED
@@ -1,25 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Pry
|
2
|
-
class Command
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
class Command
|
5
|
+
class Nesting < Pry::ClassCommand
|
6
|
+
match 'nesting'
|
7
|
+
group 'Navigating Pry'
|
8
|
+
description 'Show nesting information.'
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
+
banner <<-'BANNER'
|
11
|
+
Show nesting information.
|
12
|
+
BANNER
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
def process
|
15
|
+
output.puts 'Nesting status:'
|
16
|
+
output.puts '--'
|
17
|
+
pry_instance.binding_stack.each_with_index do |obj, level|
|
18
|
+
if level == 0
|
19
|
+
output.puts "#{level}. #{Pry.view_clip(obj.eval('self'))} (Pry top level)"
|
20
|
+
else
|
21
|
+
output.puts "#{level}. #{Pry.view_clip(obj.eval('self'))}"
|
22
|
+
end
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
22
|
-
end
|
23
26
|
|
24
|
-
|
27
|
+
Pry::Commands.add_command(Pry::Command::Nesting)
|
28
|
+
end
|
25
29
|
end
|