byebug 9.0.5 → 11.1.3

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.
Files changed (133) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +399 -264
  3. data/CONTRIBUTING.md +12 -19
  4. data/GUIDE.md +40 -26
  5. data/LICENSE +18 -18
  6. data/README.md +103 -74
  7. data/exe/byebug +6 -0
  8. data/ext/byebug/breakpoint.c +2 -2
  9. data/ext/byebug/byebug.c +26 -31
  10. data/ext/byebug/byebug.h +44 -28
  11. data/ext/byebug/context.c +45 -32
  12. data/ext/byebug/extconf.rb +7 -5
  13. data/ext/byebug/locker.c +4 -4
  14. data/ext/byebug/threads.c +12 -12
  15. data/lib/byebug/attacher.rb +18 -4
  16. data/lib/byebug/breakpoint.rb +26 -6
  17. data/lib/byebug/command.rb +20 -14
  18. data/lib/byebug/command_list.rb +3 -1
  19. data/lib/byebug/commands/break.rb +36 -22
  20. data/lib/byebug/commands/catch.rb +16 -18
  21. data/lib/byebug/commands/condition.rb +11 -11
  22. data/lib/byebug/commands/continue.rb +32 -12
  23. data/lib/byebug/commands/debug.rb +7 -5
  24. data/lib/byebug/commands/delete.rb +13 -11
  25. data/lib/byebug/commands/disable/breakpoints.rb +7 -5
  26. data/lib/byebug/commands/disable/display.rb +7 -5
  27. data/lib/byebug/commands/disable.rb +8 -6
  28. data/lib/byebug/commands/display.rb +11 -9
  29. data/lib/byebug/commands/down.rb +10 -8
  30. data/lib/byebug/commands/edit.rb +11 -8
  31. data/lib/byebug/commands/enable/breakpoints.rb +7 -5
  32. data/lib/byebug/commands/enable/display.rb +7 -5
  33. data/lib/byebug/commands/enable.rb +8 -6
  34. data/lib/byebug/commands/finish.rb +9 -7
  35. data/lib/byebug/commands/frame.rb +11 -9
  36. data/lib/byebug/commands/help.rb +7 -5
  37. data/lib/byebug/commands/history.rb +7 -5
  38. data/lib/byebug/commands/info/breakpoints.rb +18 -14
  39. data/lib/byebug/commands/info/display.rb +16 -9
  40. data/lib/byebug/commands/info/file.rb +13 -14
  41. data/lib/byebug/commands/info/line.rb +5 -3
  42. data/lib/byebug/commands/info/program.rb +8 -6
  43. data/lib/byebug/commands/info.rb +11 -9
  44. data/lib/byebug/commands/interrupt.rb +8 -4
  45. data/lib/byebug/commands/irb.rb +13 -12
  46. data/lib/byebug/commands/kill.rb +11 -11
  47. data/lib/byebug/commands/list.rb +41 -46
  48. data/lib/byebug/commands/method.rb +10 -8
  49. data/lib/byebug/commands/next.rb +8 -6
  50. data/lib/byebug/commands/pry.rb +10 -10
  51. data/lib/byebug/commands/quit.rb +10 -8
  52. data/lib/byebug/commands/restart.rb +30 -11
  53. data/lib/byebug/commands/save.rb +10 -8
  54. data/lib/byebug/commands/set.rb +13 -11
  55. data/lib/byebug/commands/show.rb +7 -5
  56. data/lib/byebug/commands/skip.rb +85 -0
  57. data/lib/byebug/commands/source.rb +7 -7
  58. data/lib/byebug/commands/step.rb +8 -6
  59. data/lib/byebug/commands/thread/current.rb +6 -4
  60. data/lib/byebug/commands/thread/list.rb +7 -5
  61. data/lib/byebug/commands/thread/resume.rb +7 -7
  62. data/lib/byebug/commands/thread/stop.rb +6 -4
  63. data/lib/byebug/commands/thread/switch.rb +6 -4
  64. data/lib/byebug/commands/thread.rb +11 -9
  65. data/lib/byebug/commands/tracevar.rb +10 -11
  66. data/lib/byebug/commands/undisplay.rb +12 -11
  67. data/lib/byebug/commands/untracevar.rb +8 -6
  68. data/lib/byebug/commands/up.rb +10 -8
  69. data/lib/byebug/commands/var/all.rb +7 -5
  70. data/lib/byebug/commands/var/args.rb +6 -4
  71. data/lib/byebug/commands/var/const.rb +9 -9
  72. data/lib/byebug/commands/var/global.rb +5 -3
  73. data/lib/byebug/commands/var/instance.rb +6 -4
  74. data/lib/byebug/commands/var/local.rb +6 -4
  75. data/lib/byebug/commands/var.rb +12 -10
  76. data/lib/byebug/commands/where.rb +9 -7
  77. data/lib/byebug/commands.rb +40 -37
  78. data/lib/byebug/context.rb +7 -5
  79. data/lib/byebug/core.rb +26 -25
  80. data/lib/byebug/errors.rb +4 -2
  81. data/lib/byebug/frame.rb +19 -22
  82. data/lib/byebug/helpers/bin.rb +47 -0
  83. data/lib/byebug/helpers/eval.rb +15 -13
  84. data/lib/byebug/helpers/file.rb +6 -4
  85. data/lib/byebug/helpers/frame.rb +7 -5
  86. data/lib/byebug/helpers/parse.rb +5 -5
  87. data/lib/byebug/helpers/path.rb +9 -11
  88. data/lib/byebug/helpers/reflection.rb +2 -0
  89. data/lib/byebug/helpers/string.rb +11 -2
  90. data/lib/byebug/helpers/thread.rb +10 -8
  91. data/lib/byebug/helpers/toggle.rb +28 -27
  92. data/lib/byebug/helpers/var.rb +9 -7
  93. data/lib/byebug/history.rb +20 -11
  94. data/lib/byebug/interface.rb +13 -11
  95. data/lib/byebug/interfaces/local_interface.rb +25 -7
  96. data/lib/byebug/interfaces/remote_interface.rb +21 -9
  97. data/lib/byebug/interfaces/script_interface.rb +4 -1
  98. data/lib/byebug/interfaces/test_interface.rb +5 -3
  99. data/lib/byebug/option_setter.rb +14 -12
  100. data/lib/byebug/printers/base.rb +10 -10
  101. data/lib/byebug/printers/plain.rb +9 -8
  102. data/lib/byebug/printers/texts/base.yml +7 -3
  103. data/lib/byebug/printers/texts/plain.yml +1 -1
  104. data/lib/byebug/processors/command_processor.rb +11 -12
  105. data/lib/byebug/processors/control_processor.rb +4 -6
  106. data/lib/byebug/processors/post_mortem_processor.rb +4 -2
  107. data/lib/byebug/processors/script_processor.rb +7 -3
  108. data/lib/byebug/remote/client.rb +57 -0
  109. data/lib/byebug/remote/server.rb +47 -0
  110. data/lib/byebug/remote.rb +46 -66
  111. data/lib/byebug/runner.rb +43 -49
  112. data/lib/byebug/setting.rb +11 -5
  113. data/lib/byebug/settings/autoirb.rb +7 -5
  114. data/lib/byebug/settings/autolist.rb +7 -5
  115. data/lib/byebug/settings/autopry.rb +7 -5
  116. data/lib/byebug/settings/autosave.rb +4 -2
  117. data/lib/byebug/settings/basename.rb +4 -2
  118. data/lib/byebug/settings/callstyle.rb +4 -3
  119. data/lib/byebug/settings/fullpath.rb +4 -2
  120. data/lib/byebug/settings/histfile.rb +5 -3
  121. data/lib/byebug/settings/histsize.rb +4 -2
  122. data/lib/byebug/settings/linetrace.rb +6 -4
  123. data/lib/byebug/settings/listsize.rb +4 -2
  124. data/lib/byebug/settings/post_mortem.rb +6 -4
  125. data/lib/byebug/settings/savefile.rb +4 -2
  126. data/lib/byebug/settings/stack_on_error.rb +4 -2
  127. data/lib/byebug/settings/width.rb +3 -1
  128. data/lib/byebug/source_file_formatter.rb +71 -0
  129. data/lib/byebug/subcommands.rb +6 -4
  130. data/lib/byebug/version.rb +2 -1
  131. data/lib/byebug.rb +3 -1
  132. metadata +22 -20
  133. data/bin/byebug +0 -7
@@ -1,4 +1,6 @@
1
- require 'byebug/helpers/file'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../helpers/file"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -10,6 +12,7 @@ module Byebug
10
12
  #
11
13
  class FileCommand < Command
12
14
  include Helpers::FileHelper
15
+ include Helpers::StringHelper
13
16
 
14
17
  self.allow_in_post_mortem = true
15
18
 
@@ -18,28 +21,25 @@ module Byebug
18
21
  end
19
22
 
20
23
  def self.description
21
- <<-EOD
24
+ <<-DESCRIPTION
22
25
  inf[o] f[ile]
23
26
 
24
27
  #{short_description}
25
28
 
26
29
  It informs about file name, number of lines, possible breakpoints in
27
30
  the file, last modification time and sha1 digest.
28
- EOD
31
+ DESCRIPTION
29
32
  end
30
33
 
31
34
  def self.short_description
32
- 'Information about a particular source file.'
35
+ "Information about a particular source file."
33
36
  end
34
37
 
35
38
  def execute
36
39
  file = @match[1] || frame.file
37
- unless File.exist?(file)
38
- return errmsg(pr('info.errors.undefined_file', file: file))
39
- end
40
-
41
- puts <<-EOC.gsub(/^ {6}/, '')
40
+ return errmsg(pr("info.errors.undefined_file", file: file)) unless File.exist?(file)
42
41
 
42
+ puts prettify <<-RUBY
43
43
  File #{info_file_basic(file)}
44
44
 
45
45
  Breakpoint line numbers: #{info_file_breakpoints(file)}
@@ -47,8 +47,7 @@ module Byebug
47
47
  Modification time: #{info_file_mtime(file)}
48
48
 
49
49
  Sha1 Signature: #{info_file_sha1(file)}
50
-
51
- EOC
50
+ RUBY
52
51
  end
53
52
 
54
53
  private
@@ -57,7 +56,7 @@ module Byebug
57
56
  path = File.expand_path(file)
58
57
  return unless File.exist?(path)
59
58
 
60
- s = n_lines(path) == 1 ? '' : 's'
59
+ s = n_lines(path) == 1 ? "" : "s"
61
60
  "#{path} (#{n_lines(path)} line#{s})"
62
61
  end
63
62
 
@@ -65,7 +64,7 @@ module Byebug
65
64
  breakpoints = Breakpoint.potential_lines(file)
66
65
  return unless breakpoints
67
66
 
68
- breakpoints.to_a.sort.join(' ')
67
+ breakpoints.to_a.sort.join(" ")
69
68
  end
70
69
 
71
70
  def info_file_mtime(file)
@@ -73,7 +72,7 @@ module Byebug
73
72
  end
74
73
 
75
74
  def info_file_sha1(file)
76
- require 'digest/sha1'
75
+ require "digest/sha1"
77
76
  Digest::SHA1.hexdigest(file)
78
77
  end
79
78
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Byebug
2
4
  #
3
5
  # Reopens the +info+ command to define the +line+ subcommand
@@ -14,15 +16,15 @@ module Byebug
14
16
  end
15
17
 
16
18
  def self.description
17
- <<-EOD
19
+ <<-DESCRIPTION
18
20
  inf[o] l[ine]
19
21
 
20
22
  #{short_description}
21
- EOD
23
+ DESCRIPTION
22
24
  end
23
25
 
24
26
  def self.short_description
25
- 'Line number and file name of current position in source file.'
27
+ "Line number and file name of current position in source file."
26
28
  end
27
29
 
28
30
  def execute
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Byebug
2
4
  #
3
5
  # Reopens the +info+ command to define the +args+ subcommand
@@ -14,19 +16,19 @@ module Byebug
14
16
  end
15
17
 
16
18
  def self.description
17
- <<-EOD
19
+ <<-DESCRIPTION
18
20
  inf[o] p[rogram]
19
21
 
20
22
  #{short_description}
21
- EOD
23
+ DESCRIPTION
22
24
  end
23
25
 
24
26
  def self.short_description
25
- 'Information about the current status of the debugged program.'
27
+ "Information about the current status of the debugged program."
26
28
  end
27
29
 
28
30
  def execute
29
- puts 'Program stopped. '
31
+ puts "Program stopped. "
30
32
  format_stop_reason context.stop_reason
31
33
  end
32
34
 
@@ -37,9 +39,9 @@ module Byebug
37
39
  when :step
38
40
  puts "It stopped after stepping, next'ing or initial start."
39
41
  when :breakpoint
40
- puts 'It stopped at a breakpoint.'
42
+ puts "It stopped at a breakpoint."
41
43
  when :catchpoint
42
- puts 'It stopped at a catchpoint.'
44
+ puts "It stopped at a catchpoint."
43
45
  end
44
46
  end
45
47
  end
@@ -1,10 +1,12 @@
1
- require 'byebug/subcommands'
1
+ # frozen_string_literal: true
2
2
 
3
- require 'byebug/commands/info/breakpoints'
4
- require 'byebug/commands/info/display'
5
- require 'byebug/commands/info/file'
6
- require 'byebug/commands/info/line'
7
- require 'byebug/commands/info/program'
3
+ require_relative "../subcommands"
4
+
5
+ require_relative "../commands/info/breakpoints"
6
+ require_relative "../commands/info/display"
7
+ require_relative "../commands/info/file"
8
+ require_relative "../commands/info/line"
9
+ require_relative "../commands/info/program"
8
10
 
9
11
  module Byebug
10
12
  #
@@ -21,15 +23,15 @@ module Byebug
21
23
  end
22
24
 
23
25
  def self.description
24
- <<-EOD
26
+ <<-DESCRIPTION
25
27
  info[ subcommand]
26
28
 
27
29
  #{short_description}
28
- EOD
30
+ DESCRIPTION
29
31
  end
30
32
 
31
33
  def self.short_description
32
- 'Shows several informations about the program being debugged'
34
+ "Shows several informations about the program being debugged"
33
35
  end
34
36
  end
35
37
  end
@@ -1,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -12,18 +14,20 @@ module Byebug
12
14
  end
13
15
 
14
16
  def self.description
15
- <<-EOD
17
+ <<-DESCRIPTION
16
18
  int[errupt]
17
19
 
18
20
  #{short_description}
19
- EOD
21
+ DESCRIPTION
20
22
  end
21
23
 
22
24
  def self.short_description
23
- 'Interrupts the program'
25
+ "Interrupts the program"
24
26
  end
25
27
 
26
28
  def execute
29
+ Byebug.start
30
+
27
31
  Byebug.thread_context(Thread.main).interrupt
28
32
  end
29
33
  end
@@ -1,5 +1,8 @@
1
- require 'byebug/command'
2
- require 'irb'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
4
+ require "irb"
5
+ require "English"
3
6
 
4
7
  module Byebug
5
8
  #
@@ -13,23 +16,21 @@ module Byebug
13
16
  end
14
17
 
15
18
  def self.description
16
- <<-EOD
19
+ <<-DESCRIPTION
17
20
  irb
18
21
 
19
22
  #{short_description}
20
- EOD
23
+ DESCRIPTION
21
24
  end
22
25
 
23
26
  def self.short_description
24
- 'Starts an IRB session'
27
+ "Starts an IRB session"
25
28
  end
26
29
 
27
30
  def execute
28
- unless processor.interface.instance_of?(LocalInterface)
29
- return errmsg(pr('base.errors.only_local'))
30
- end
31
+ return errmsg(pr("base.errors.only_local")) unless processor.interface.instance_of?(LocalInterface)
31
32
 
32
- # @todo IRB tries to parse ARGV so we must clear it (see #197). Add a
33
+ # @todo IRB tries to parse $ARGV so we must clear it (see #197). Add a
33
34
  # test case for it so we can remove this comment.
34
35
  with_clean_argv { IRB.start }
35
36
  end
@@ -37,12 +38,12 @@ module Byebug
37
38
  private
38
39
 
39
40
  def with_clean_argv
40
- saved_argv = ARGV.dup
41
- ARGV.clear
41
+ saved_argv = $ARGV.dup
42
+ $ARGV.clear
42
43
  begin
43
44
  yield
44
45
  ensure
45
- ARGV.concat(saved_argv)
46
+ $ARGV.concat(saved_argv)
46
47
  end
47
48
  end
48
49
  end
@@ -1,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -8,37 +10,35 @@ module Byebug
8
10
  self.allow_in_control = true
9
11
 
10
12
  def self.regexp
11
- /^\s* (?:kill) \s* (?:\s+(\S+))? \s*$/x
13
+ /^\s* kill \s* (?:\s+(\S+))? \s*$/x
12
14
  end
13
15
 
14
16
  def self.description
15
- <<-EOD
17
+ <<-DESCRIPTION
16
18
  kill[ signal]
17
19
 
18
20
  #{short_description}
19
21
 
20
22
  Equivalent of Process.kill(Process.pid)
21
- EOD
23
+ DESCRIPTION
22
24
  end
23
25
 
24
26
  def self.short_description
25
- 'Sends a signal to the current process'
27
+ "Sends a signal to the current process"
26
28
  end
27
29
 
28
30
  def execute
29
31
  if @match[1]
30
32
  signame = @match[1]
31
33
 
32
- unless Signal.list.member?(signame)
33
- return errmsg("signal name #{signame} is not a signal I know about\n")
34
- end
34
+ return errmsg("signal name #{signame} is not a signal I know about\n") unless Signal.list.member?(signame)
35
35
  else
36
- return unless confirm('Really kill? (y/n) ')
36
+ return unless confirm("Really kill? (y/n) ")
37
37
 
38
- signame = 'KILL'
38
+ signame = "KILL"
39
39
  end
40
40
 
41
- processor.interface.close if 'KILL' == signame
41
+ processor.interface.close if signame == "KILL"
42
42
  Process.kill(signame, Process.pid)
43
43
  end
44
44
  end
@@ -1,6 +1,9 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/file'
3
- require 'byebug/helpers/parse'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
4
+ require_relative "../source_file_formatter"
5
+ require_relative "../helpers/file"
6
+ require_relative "../helpers/parse"
4
7
 
5
8
  module Byebug
6
9
  #
@@ -17,7 +20,7 @@ module Byebug
17
20
  end
18
21
 
19
22
  def self.description
20
- <<-EOD
23
+ <<-DESCRIPTION
21
24
  l[ist][[-=]][ nn-mm]
22
25
 
23
26
  #{short_description}
@@ -27,20 +30,18 @@ module Byebug
27
30
  "list=" is specified, lists from current line regardless of where code
28
31
  was last listed. A line range can also be specified to list specific
29
32
  sections of code.
30
- EOD
33
+ DESCRIPTION
31
34
  end
32
35
 
33
36
  def self.short_description
34
- 'Lists lines of source code'
37
+ "Lists lines of source code"
35
38
  end
36
39
 
37
40
  def execute
38
41
  msg = "No sourcefile available for #{frame.file}"
39
42
  raise(msg) unless File.exist?(frame.file)
40
43
 
41
- max_lines = n_lines(frame.file)
42
- b, e = range(@match[2], max_lines)
43
- raise('Invalid line range') unless valid_range?(b, e, max_lines)
44
+ b, e = range(@match[2])
44
45
 
45
46
  display_lines(b, e)
46
47
 
@@ -56,42 +57,44 @@ module Byebug
56
57
  #
57
58
  # Otherwise it's automatically chosen.
58
59
  #
59
- def range(input, max_line)
60
- size = [Setting[:listsize], max_line].min
60
+ def range(input)
61
+ return auto_range(@match[1] || "+") unless input
61
62
 
62
- return set_range(size, max_line) unless input
63
+ b, e = parse_range(input)
64
+ raise("Invalid line range") unless valid_range?(b, e)
63
65
 
64
- parse_range(input, size, max_line)
66
+ [b, e]
65
67
  end
66
68
 
67
- def valid_range?(first, last, max)
68
- first <= last && (1..max).cover?(first) && (1..max).cover?(last)
69
+ def valid_range?(first, last)
70
+ first <= last && (1..max_line).cover?(first) && (1..max_line).cover?(last)
69
71
  end
70
72
 
71
73
  #
72
74
  # Set line range to be printed by list
73
75
  #
74
- # @param size - number of lines to be printed
75
- # @param max_line - max line number that can be printed
76
- #
77
76
  # @return first line number to list
78
77
  # @return last line number to list
79
78
  #
80
- def set_range(size, max_line)
81
- first = amend(lower(size, @match[1] || '+'), max_line - size + 1)
79
+ def auto_range(direction)
80
+ prev_line = processor.prev_line
82
81
 
83
- [first, move(first, size - 1)]
82
+ if direction == "=" || prev_line.nil?
83
+ source_file_formatter.range_around(frame.line)
84
+ else
85
+ source_file_formatter.range_from(move(prev_line, size, direction))
86
+ end
84
87
  end
85
88
 
86
- def parse_range(input, size, max_line)
87
- first, err = get_int(lower_bound(input), 'List', 1, max_line)
89
+ def parse_range(input)
90
+ first, err = get_int(lower_bound(input), "List", 1, max_line)
88
91
  raise(err) unless first
89
92
 
90
93
  if upper_bound(input)
91
- last, err = get_int(upper_bound(input), 'List', 1, max_line)
94
+ last, err = get_int(upper_bound(input), "List", 1, max_line)
92
95
  raise(err) unless last
93
96
 
94
- last = amend(last, max_line)
97
+ last = amend_final(last)
95
98
  else
96
99
  first -= (size / 2)
97
100
  end
@@ -99,20 +102,7 @@ module Byebug
99
102
  [first, last || move(first, size - 1)]
100
103
  end
101
104
 
102
- def amend(line, max_line)
103
- return 1 if line < 1
104
-
105
- [max_line, line].min
106
- end
107
-
108
- def lower(size, direction = '+')
109
- prev_line = processor.prev_line
110
- return frame.line - size / 2 if direction == '=' || prev_line.nil?
111
-
112
- move(prev_line, size, direction)
113
- end
114
-
115
- def move(line, size, direction = '+')
105
+ def move(line, size, direction = "+")
116
106
  line.send(direction, size)
117
107
  end
118
108
 
@@ -125,13 +115,7 @@ module Byebug
125
115
  def display_lines(min, max)
126
116
  puts "\n[#{min}, #{max}] in #{frame.file}"
127
117
 
128
- File.foreach(frame.file).with_index do |line, lineno|
129
- break if lineno + 1 > max
130
- next unless (min..max).cover?(lineno + 1)
131
-
132
- mark = lineno + 1 == frame.line ? '=> ' : ' '
133
- puts format("#{mark}%#{max.to_s.size}d: %s", lineno + 1, line)
134
- end
118
+ puts source_file_formatter.lines(min, max).join
135
119
  end
136
120
 
137
121
  #
@@ -160,5 +144,16 @@ module Byebug
160
144
  def split_range(str)
161
145
  str.split(/[-,]/)
162
146
  end
147
+
148
+ extend Forwardable
149
+
150
+ def_delegators :source_file_formatter, :amend_final, :size, :max_line
151
+
152
+ def source_file_formatter
153
+ @source_file_formatter ||= SourceFileFormatter.new(
154
+ frame.file,
155
+ ->(n) { n == frame.line ? "=>" : " " }
156
+ )
157
+ end
163
158
  end
164
159
  end
@@ -1,5 +1,7 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/eval'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
4
+ require_relative "../helpers/eval"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -15,7 +17,7 @@ module Byebug
15
17
  end
16
18
 
17
19
  def self.description
18
- <<-EOD
20
+ <<-DESCRIPTION
19
21
  m[ethod] (i[nstance][ <obj>]|<class|module>)
20
22
 
21
23
  #{short_description}
@@ -25,11 +27,11 @@ module Byebug
25
27
 
26
28
  When invoked only with a class or module, shows class methods of the
27
29
  class or module specified as argument.
28
- EOD
30
+ DESCRIPTION
29
31
  end
30
32
 
31
33
  def self.short_description
32
- 'Shows methods of an object, class or module'
34
+ "Shows methods of an object, class or module"
33
35
  end
34
36
 
35
37
  def execute
@@ -37,11 +39,11 @@ module Byebug
37
39
 
38
40
  result =
39
41
  if @match[1]
40
- prc('method.methods', obj.methods.sort) { |item, _| { name: item } }
42
+ prc("method.methods", obj.methods.sort) { |item, _| { name: item } }
41
43
  elsif !obj.is_a?(Module)
42
- pr('variable.errors.not_module', object: @match.post_match)
44
+ pr("variable.errors.not_module", object: @match.post_match)
43
45
  else
44
- prc('method.methods', obj.instance_methods(false).sort) do |item, _|
46
+ prc("method.methods", obj.instance_methods(false).sort) do |item, _|
45
47
  { name: item }
46
48
  end
47
49
  end
@@ -1,5 +1,7 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/parse'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
4
+ require_relative "../helpers/parse"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -16,19 +18,19 @@ module Byebug
16
18
  end
17
19
 
18
20
  def self.description
19
- <<-EOD
21
+ <<-DESCRIPTION
20
22
  n[ext][ nnn]
21
23
 
22
24
  #{short_description}
23
- EOD
25
+ DESCRIPTION
24
26
  end
25
27
 
26
28
  def self.short_description
27
- 'Runs one or more lines of code'
29
+ "Runs one or more lines of code"
28
30
  end
29
31
 
30
32
  def execute
31
- steps, err = parse_steps(@match[1], 'Next')
33
+ steps, err = parse_steps(@match[1], "Next")
32
34
  return errmsg(err) unless steps
33
35
 
34
36
  context.step_over(steps, context.frame.pos)
@@ -1,5 +1,7 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/eval'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
4
+ require_relative "../helpers/eval"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -13,26 +15,24 @@ module Byebug
13
15
  end
14
16
 
15
17
  def self.description
16
- <<-EOD
18
+ <<-DESCRIPTION
17
19
  pry
18
20
 
19
21
  #{short_description}
20
- EOD
22
+ DESCRIPTION
21
23
  end
22
24
 
23
25
  def self.short_description
24
- 'Starts a Pry session'
26
+ "Starts a Pry session"
25
27
  end
26
28
 
27
29
  def execute
28
- unless processor.interface.instance_of?(LocalInterface)
29
- return errmsg(pr('base.errors.only_local'))
30
- end
30
+ return errmsg(pr("base.errors.only_local")) unless processor.interface.instance_of?(LocalInterface)
31
31
 
32
32
  begin
33
- require 'pry'
33
+ require "pry"
34
34
  rescue LoadError
35
- return errmsg(pr('pry.errors.not_installed'))
35
+ return errmsg(pr("pry.errors.not_installed"))
36
36
  end
37
37
 
38
38
  Pry.start(context.frame._binding)
@@ -1,4 +1,6 @@
1
- require 'byebug/command'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -13,23 +15,23 @@ module Byebug
13
15
  end
14
16
 
15
17
  def self.description
16
- <<-EOD
17
- q[uit] [!|unconditionally]
18
+ <<-DESCRIPTION
19
+ q[uit][!| unconditionally]
18
20
 
19
21
  #{short_description}
20
22
 
21
- Normally we prompt before exiting. However if the parameter
22
- "unconditionally" is given or command is suffixed with !, we exit
23
+ Normally we prompt before exiting. However, if the parameter
24
+ "unconditionally" is given or command is suffixed with "!", we exit
23
25
  without asking further questions.
24
- EOD
26
+ DESCRIPTION
25
27
  end
26
28
 
27
29
  def self.short_description
28
- 'Exits byebug'
30
+ "Exits byebug"
29
31
  end
30
32
 
31
33
  def execute
32
- return unless @match[1] || confirm(pr('quit.confirmations.really'))
34
+ return unless @match[1] || confirm(pr("quit.confirmations.really"))
33
35
 
34
36
  processor.interface.autosave
35
37
  processor.interface.close