byebug 9.1.0 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +24 -3
  3. data/CONTRIBUTING.md +39 -18
  4. data/GUIDE.md +16 -17
  5. data/README.md +64 -52
  6. data/exe/byebug +6 -0
  7. data/ext/byebug/breakpoint.c +1 -1
  8. data/ext/byebug/byebug.c +16 -16
  9. data/ext/byebug/byebug.h +40 -26
  10. data/ext/byebug/context.c +26 -26
  11. data/ext/byebug/extconf.rb +7 -5
  12. data/ext/byebug/threads.c +8 -8
  13. data/lib/byebug.rb +3 -1
  14. data/lib/byebug/attacher.rb +17 -3
  15. data/lib/byebug/breakpoint.rb +25 -3
  16. data/lib/byebug/command.rb +20 -14
  17. data/lib/byebug/command_list.rb +3 -1
  18. data/lib/byebug/commands.rb +39 -37
  19. data/lib/byebug/commands/break.rb +33 -15
  20. data/lib/byebug/commands/catch.rb +16 -14
  21. data/lib/byebug/commands/condition.rb +11 -9
  22. data/lib/byebug/commands/continue.rb +9 -7
  23. data/lib/byebug/commands/debug.rb +7 -5
  24. data/lib/byebug/commands/delete.rb +11 -9
  25. data/lib/byebug/commands/disable.rb +8 -6
  26. data/lib/byebug/commands/disable/breakpoints.rb +7 -5
  27. data/lib/byebug/commands/disable/display.rb +7 -5
  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 +10 -8
  31. data/lib/byebug/commands/enable.rb +8 -6
  32. data/lib/byebug/commands/enable/breakpoints.rb +7 -5
  33. data/lib/byebug/commands/enable/display.rb +7 -5
  34. data/lib/byebug/commands/finish.rb +8 -6
  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.rb +11 -9
  39. data/lib/byebug/commands/info/breakpoints.rb +17 -11
  40. data/lib/byebug/commands/info/display.rb +16 -7
  41. data/lib/byebug/commands/info/file.rb +12 -10
  42. data/lib/byebug/commands/info/line.rb +5 -3
  43. data/lib/byebug/commands/info/program.rb +8 -6
  44. data/lib/byebug/commands/interrupt.rb +8 -4
  45. data/lib/byebug/commands/irb.rb +9 -7
  46. data/lib/byebug/commands/kill.rb +9 -7
  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 -8
  51. data/lib/byebug/commands/quit.rb +7 -5
  52. data/lib/byebug/commands/restart.rb +13 -11
  53. data/lib/byebug/commands/save.rb +9 -7
  54. data/lib/byebug/commands/set.rb +12 -10
  55. data/lib/byebug/commands/show.rb +7 -5
  56. data/lib/byebug/commands/source.rb +7 -5
  57. data/lib/byebug/commands/step.rb +8 -6
  58. data/lib/byebug/commands/thread.rb +11 -9
  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 -5
  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/tracevar.rb +10 -8
  65. data/lib/byebug/commands/undisplay.rb +10 -8
  66. data/lib/byebug/commands/untracevar.rb +8 -6
  67. data/lib/byebug/commands/up.rb +10 -8
  68. data/lib/byebug/commands/var.rb +12 -10
  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 -7
  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/where.rb +9 -7
  76. data/lib/byebug/context.rb +7 -5
  77. data/lib/byebug/core.rb +25 -25
  78. data/lib/byebug/errors.rb +4 -2
  79. data/lib/byebug/frame.rb +16 -16
  80. data/lib/byebug/helpers/bin.rb +28 -7
  81. data/lib/byebug/helpers/eval.rb +8 -6
  82. data/lib/byebug/helpers/file.rb +4 -2
  83. data/lib/byebug/helpers/frame.rb +5 -3
  84. data/lib/byebug/helpers/parse.rb +5 -3
  85. data/lib/byebug/helpers/path.rb +7 -5
  86. data/lib/byebug/helpers/reflection.rb +2 -0
  87. data/lib/byebug/helpers/string.rb +4 -2
  88. data/lib/byebug/helpers/thread.rb +10 -8
  89. data/lib/byebug/helpers/toggle.rb +10 -8
  90. data/lib/byebug/helpers/var.rb +8 -6
  91. data/lib/byebug/history.rb +7 -5
  92. data/lib/byebug/interface.rb +13 -11
  93. data/lib/byebug/interfaces/local_interface.rb +4 -4
  94. data/lib/byebug/interfaces/remote_interface.rb +21 -9
  95. data/lib/byebug/interfaces/script_interface.rb +2 -0
  96. data/lib/byebug/interfaces/test_interface.rb +5 -3
  97. data/lib/byebug/option_setter.rb +14 -12
  98. data/lib/byebug/printers/base.rb +6 -6
  99. data/lib/byebug/printers/plain.rb +8 -6
  100. data/lib/byebug/printers/texts/base.yml +3 -3
  101. data/lib/byebug/processors/command_processor.rb +11 -12
  102. data/lib/byebug/processors/control_processor.rb +4 -6
  103. data/lib/byebug/processors/post_mortem_processor.rb +4 -2
  104. data/lib/byebug/processors/script_processor.rb +7 -3
  105. data/lib/byebug/remote.rb +45 -65
  106. data/lib/byebug/remote/client.rb +55 -0
  107. data/lib/byebug/remote/server.rb +47 -0
  108. data/lib/byebug/runner.rb +26 -19
  109. data/lib/byebug/setting.rb +10 -4
  110. data/lib/byebug/settings/autoirb.rb +5 -3
  111. data/lib/byebug/settings/autolist.rb +5 -3
  112. data/lib/byebug/settings/autopry.rb +5 -3
  113. data/lib/byebug/settings/autosave.rb +4 -2
  114. data/lib/byebug/settings/basename.rb +4 -2
  115. data/lib/byebug/settings/callstyle.rb +3 -3
  116. data/lib/byebug/settings/fullpath.rb +4 -2
  117. data/lib/byebug/settings/histfile.rb +5 -3
  118. data/lib/byebug/settings/histsize.rb +4 -2
  119. data/lib/byebug/settings/linetrace.rb +4 -2
  120. data/lib/byebug/settings/listsize.rb +4 -2
  121. data/lib/byebug/settings/post_mortem.rb +4 -2
  122. data/lib/byebug/settings/savefile.rb +4 -2
  123. data/lib/byebug/settings/stack_on_error.rb +4 -2
  124. data/lib/byebug/settings/width.rb +3 -1
  125. data/lib/byebug/source_file_formatter.rb +71 -0
  126. data/lib/byebug/subcommands.rb +6 -4
  127. data/lib/byebug/version.rb +1 -1
  128. metadata +8 -5
  129. data/bin/byebug +0 -9
@@ -1 +1,3 @@
1
- require 'byebug/attacher'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/attacher"
@@ -1,13 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Main Container for all of Byebug's code
3
5
  #
4
6
  module Byebug
5
7
  #
6
- # Enters byebug right before (or right after if _before_ is false) return
7
- # events occur. Before entering byebug the init script is read.
8
+ # Starts byebug, and stops at the first line of user's code.
8
9
  #
9
10
  def self.attach
10
- require 'byebug/core'
11
+ require "byebug/core"
11
12
 
12
13
  unless started?
13
14
  self.mode = :attached
@@ -18,6 +19,13 @@ module Byebug
18
19
 
19
20
  current_context.step_out(3, true)
20
21
  end
22
+
23
+ def self.spawn(host = "localhost", port = nil)
24
+ require "byebug/core"
25
+
26
+ self.wait_connection = true
27
+ start_server(host, port || PORT)
28
+ end
21
29
  end
22
30
 
23
31
  #
@@ -30,5 +38,11 @@ module Kernel
30
38
  Byebug.attach
31
39
  end
32
40
 
41
+ def remote_byebug(host = "localhost", port = nil)
42
+ Byebug.spawn(host, port)
43
+
44
+ Byebug.attach
45
+ end
46
+
33
47
  alias debugger byebug
34
48
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Byebug
2
4
  #
3
5
  # Implements breakpoints
@@ -49,12 +51,30 @@ module Byebug
49
51
  #
50
52
  def self.potential_lines(filename)
51
53
  name = "#{Time.new.to_i}_#{rand(2**31)}"
52
- lines = {}
53
54
  iseq = RubyVM::InstructionSequence.compile(File.read(filename), name)
54
55
 
56
+ if iseq.respond_to?(:each_child)
57
+ potential_lines_with_trace_points(iseq, {})
58
+ else
59
+ potential_lines_without_trace_points(iseq, {})
60
+ end
61
+ end
62
+
63
+ def self.potential_lines_with_trace_points(iseq, lines)
64
+ iseq.trace_points.each { |(line, _)| lines[line] = true }
65
+ iseq.each_child do |child|
66
+ potential_lines_with_trace_points(child, lines)
67
+ end
68
+
69
+ lines.keys.sort
70
+ end
71
+
72
+ private_class_method :potential_lines_with_trace_points
73
+
74
+ def self.potential_lines_without_trace_points(iseq, lines)
55
75
  iseq.disasm.each_line do |line|
56
76
  res = /^\d+ (?<insn>\w+)\s+.+\(\s*(?<lineno>\d+)\)$/.match(line)
57
- next unless res && res[:insn] == 'trace'
77
+ next unless res && res[:insn] == "trace"
58
78
 
59
79
  lines[res[:lineno].to_i] = true
60
80
  end
@@ -62,6 +82,8 @@ module Byebug
62
82
  lines.keys
63
83
  end
64
84
 
85
+ private_class_method :potential_lines_without_trace_points
86
+
65
87
  #
66
88
  # Returns true if a breakpoint could be set in line number +lineno+ in file
67
89
  # name +filename.
@@ -82,7 +104,7 @@ module Byebug
82
104
  #
83
105
  def inspect
84
106
  meths = %w[id pos source expr hit_condition hit_count hit_value enabled?]
85
- values = meths.map { |field| "#{field}: #{send(field)}" }.join(', ')
107
+ values = meths.map { |field| "#{field}: #{send(field)}" }.join(", ")
86
108
  "#<Byebug::Breakpoint #{values}>"
87
109
  end
88
110
  end
@@ -1,5 +1,7 @@
1
- require 'forwardable'
2
- require 'byebug/helpers/string'
1
+ # frozen_string_literal: true
2
+
3
+ require "forwardable"
4
+ require "byebug/helpers/string"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -16,11 +18,11 @@ module Byebug
16
18
  # end
17
19
  #
18
20
  # def self.description
19
- # 'Custom long desc'
21
+ # "Custom long desc"
20
22
  # end
21
23
  #
22
24
  # def.short_description
23
- # 'Custom short desc'
25
+ # "Custom short desc"
24
26
  # end
25
27
  #
26
28
  # def execute
@@ -47,16 +49,16 @@ module Byebug
47
49
  end
48
50
 
49
51
  def arguments
50
- @match[0].split(' ').drop(1).join(' ')
52
+ @match[0].split(" ").drop(1).join(" ")
51
53
  end
52
54
 
53
- def_delegators :'self.class', :help, :match
55
+ def_delegators "self.class", :help, :match
54
56
 
55
- def_delegator :'processor.printer', :print, :pr
56
- def_delegator :'processor.printer', :print_collection, :prc
57
- def_delegator :'processor.printer', :print_variables, :prv
57
+ def_delegator "processor.printer", :print, :pr
58
+ def_delegator "processor.printer", :print_collection, :prc
59
+ def_delegator "processor.printer", :print_variables, :prv
58
60
 
59
- def_delegators :'processor.interface', :errmsg, :puts, :print, :confirm
61
+ def_delegators "processor.interface", :errmsg, :puts, :print, :confirm
60
62
 
61
63
  class << self
62
64
  include Helpers::StringHelper
@@ -77,14 +79,18 @@ module Byebug
77
79
  #
78
80
  def to_s
79
81
  name
80
- .split('::')
81
- .map { |n| n.gsub(/Command$/, '').downcase if n =~ /Command$/ }
82
+ .split("::")
83
+ .map { |n| n.gsub(/Command$/, "").downcase if n =~ /Command$/ }
82
84
  .compact
83
- .join(' ')
85
+ .join(" ")
84
86
  end
85
87
 
86
88
  def columnize(width)
87
- format(" %-#{width}s -- %s\n", to_s, short_description)
89
+ format(
90
+ " %-<name>#{width}s -- %<description>s\n",
91
+ name: to_s,
92
+ description: short_description
93
+ )
88
94
  end
89
95
 
90
96
  #
@@ -1,4 +1,6 @@
1
- require 'byebug/errors'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/errors"
2
4
 
3
5
  module Byebug
4
6
  #
@@ -1,37 +1,39 @@
1
- require 'byebug/commands/break'
2
- require 'byebug/commands/catch'
3
- require 'byebug/commands/condition'
4
- require 'byebug/commands/continue'
5
- require 'byebug/commands/debug'
6
- require 'byebug/commands/delete'
7
- require 'byebug/commands/disable'
8
- require 'byebug/commands/display'
9
- require 'byebug/commands/down'
10
- require 'byebug/commands/edit'
11
- require 'byebug/commands/enable'
12
- require 'byebug/commands/finish'
13
- require 'byebug/commands/frame'
14
- require 'byebug/commands/help'
15
- require 'byebug/commands/history'
16
- require 'byebug/commands/info'
17
- require 'byebug/commands/interrupt'
18
- require 'byebug/commands/irb'
19
- require 'byebug/commands/kill'
20
- require 'byebug/commands/list'
21
- require 'byebug/commands/method'
22
- require 'byebug/commands/next'
23
- require 'byebug/commands/pry'
24
- require 'byebug/commands/quit'
25
- require 'byebug/commands/restart'
26
- require 'byebug/commands/save'
27
- require 'byebug/commands/set'
28
- require 'byebug/commands/show'
29
- require 'byebug/commands/source'
30
- require 'byebug/commands/step'
31
- require 'byebug/commands/thread'
32
- require 'byebug/commands/tracevar'
33
- require 'byebug/commands/undisplay'
34
- require 'byebug/commands/untracevar'
35
- require 'byebug/commands/up'
36
- require 'byebug/commands/var'
37
- require 'byebug/commands/where'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/commands/break"
4
+ require "byebug/commands/catch"
5
+ require "byebug/commands/condition"
6
+ require "byebug/commands/continue"
7
+ require "byebug/commands/debug"
8
+ require "byebug/commands/delete"
9
+ require "byebug/commands/disable"
10
+ require "byebug/commands/display"
11
+ require "byebug/commands/down"
12
+ require "byebug/commands/edit"
13
+ require "byebug/commands/enable"
14
+ require "byebug/commands/finish"
15
+ require "byebug/commands/frame"
16
+ require "byebug/commands/help"
17
+ require "byebug/commands/history"
18
+ require "byebug/commands/info"
19
+ require "byebug/commands/interrupt"
20
+ require "byebug/commands/irb"
21
+ require "byebug/commands/kill"
22
+ require "byebug/commands/list"
23
+ require "byebug/commands/method"
24
+ require "byebug/commands/next"
25
+ require "byebug/commands/pry"
26
+ require "byebug/commands/quit"
27
+ require "byebug/commands/restart"
28
+ require "byebug/commands/save"
29
+ require "byebug/commands/set"
30
+ require "byebug/commands/show"
31
+ require "byebug/commands/source"
32
+ require "byebug/commands/step"
33
+ require "byebug/commands/thread"
34
+ require "byebug/commands/tracevar"
35
+ require "byebug/commands/undisplay"
36
+ require "byebug/commands/untracevar"
37
+ require "byebug/commands/up"
38
+ require "byebug/commands/var"
39
+ require "byebug/commands/where"
@@ -1,7 +1,10 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/eval'
3
- require 'byebug/helpers/file'
4
- require 'byebug/helpers/parse'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/command"
4
+ require "byebug/helpers/eval"
5
+ require "byebug/helpers/file"
6
+ require "byebug/helpers/parse"
7
+ require "byebug/source_file_formatter"
5
8
 
6
9
  module Byebug
7
10
  #
@@ -19,7 +22,7 @@ module Byebug
19
22
  end
20
23
 
21
24
  def self.description
22
- <<-EOD
25
+ <<-DESCRIPTION
23
26
  b[reak] [file:]line [if expr]
24
27
  b[reak] [module::...]class(.|#)method [if expr]
25
28
 
@@ -27,24 +30,24 @@ module Byebug
27
30
  for conditionally enabled breakpoints.
28
31
 
29
32
  #{short_description}
30
- EOD
33
+ DESCRIPTION
31
34
  end
32
35
 
33
36
  def self.short_description
34
- 'Sets breakpoints in the source code'
37
+ "Sets breakpoints in the source code"
35
38
  end
36
39
 
37
40
  def execute
38
41
  return puts(help) unless @match[1]
39
42
 
40
43
  b = line_breakpoint(@match[1]) || method_breakpoint(@match[1])
41
- return errmsg(pr('break.errors.location')) unless b
44
+ return errmsg(pr("break.errors.location")) unless b
42
45
 
43
46
  if syntax_valid?(@match[2])
44
- return puts(pr('break.created', id: b.id, file: b.source, line: b.pos))
47
+ return puts(pr("break.created", id: b.id, file: b.source, line: b.pos))
45
48
  end
46
49
 
47
- errmsg(pr('break.errors.expression', expr: @match[2]))
50
+ errmsg(pr("break.errors.expression", expr: @match[2]))
48
51
  b.enabled = false
49
52
  end
50
53
 
@@ -74,25 +77,40 @@ module Byebug
74
77
  k = error_eval(str)
75
78
 
76
79
  k && k.is_a?(Module) ? k.name : str
77
- rescue
78
- errmsg('Warning: breakpoint source is not yet defined')
80
+ rescue StandardError
81
+ errmsg("Warning: breakpoint source is not yet defined")
79
82
  str
80
83
  end
81
84
 
82
85
  def add_line_breakpoint(file, line)
83
- raise(pr('break.errors.source', file: file)) unless File.exist?(file)
86
+ raise(pr("break.errors.source", file: file)) unless File.exist?(file)
84
87
 
85
88
  fullpath = File.realpath(file)
86
89
 
87
90
  if line > n_lines(file)
88
- raise(pr('break.errors.far_line', lines: n_lines(file), file: fullpath))
91
+ raise(pr("break.errors.far_line", lines: n_lines(file), file: fullpath))
89
92
  end
90
93
 
91
94
  unless Breakpoint.potential_line?(fullpath, line)
92
- raise(pr('break.errors.line', file: fullpath, line: line))
95
+ msg = pr(
96
+ "break.errors.line",
97
+ file: fullpath,
98
+ line: line,
99
+ valid_breakpoints: valid_breakpoints_for(fullpath, line)
100
+ )
101
+
102
+ raise(msg)
93
103
  end
94
104
 
95
105
  Breakpoint.add(fullpath, line, @match[2])
96
106
  end
107
+
108
+ def valid_breakpoints_for(path, line)
109
+ potential_lines = Breakpoint.potential_lines(path)
110
+ annotator = ->(n) { potential_lines.include?(n) ? "[B]" : " " }
111
+ source_file_formatter = SourceFileFormatter.new(path, annotator)
112
+
113
+ source_file_formatter.lines_around(line).join.chomp
114
+ end
97
115
  end
98
116
  end
@@ -1,5 +1,7 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/eval'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/command"
4
+ require "byebug/helpers/eval"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -17,7 +19,7 @@ module Byebug
17
19
  end
18
20
 
19
21
  def self.description
20
- <<-EOD
22
+ <<-DESCRIPTION
21
23
  cat[ch][ (off|<exception>[ off])]
22
24
 
23
25
  #{short_description}
@@ -26,19 +28,19 @@ module Byebug
26
28
  catch off -- deletes all catchpoints
27
29
  catch <exception> -- enables handling <exception>
28
30
  catch <exception> off -- disables handling <exception>
29
- EOD
31
+ DESCRIPTION
30
32
  end
31
33
 
32
34
  def self.short_description
33
- 'Handles exception catchpoints'
35
+ "Handles exception catchpoints"
34
36
  end
35
37
 
36
38
  def execute
37
39
  return info unless @match[1]
38
40
 
39
- return @match[1] == 'off' ? clear : add(@match[1]) unless @match[2]
41
+ return @match[1] == "off" ? clear : add(@match[1]) unless @match[2]
40
42
 
41
- return errmsg pr('catch.errors.off', off: cmd) unless @match[2] == 'off'
43
+ return errmsg pr("catch.errors.off", off: cmd) unless @match[2] == "off"
42
44
 
43
45
  remove(@match[1])
44
46
  end
@@ -47,33 +49,33 @@ module Byebug
47
49
 
48
50
  def remove(exception)
49
51
  unless Byebug.catchpoints.member?(exception)
50
- return errmsg pr('catch.errors.not_found', exception: exception)
52
+ return errmsg pr("catch.errors.not_found", exception: exception)
51
53
  end
52
54
 
53
- puts pr('catch.removed', exception: exception)
55
+ puts pr("catch.removed", exception: exception)
54
56
  Byebug.catchpoints.delete(exception)
55
57
  end
56
58
 
57
59
  def add(exception)
58
60
  if warning_eval(exception.is_a?(Class).to_s)
59
- errmsg pr('catch.errors.not_class', class: exception)
61
+ errmsg pr("catch.errors.not_class", class: exception)
60
62
  end
61
63
 
62
- puts pr('catch.added', exception: exception)
64
+ puts pr("catch.added", exception: exception)
63
65
  Byebug.add_catchpoint(exception)
64
66
  end
65
67
 
66
68
  def clear
67
- Byebug.catchpoints.clear if confirm(pr('catch.confirmations.delete_all'))
69
+ Byebug.catchpoints.clear if confirm(pr("catch.confirmations.delete_all"))
68
70
  end
69
71
 
70
72
  def info
71
73
  if Byebug.catchpoints && !Byebug.catchpoints.empty?
72
- Byebug.catchpoints.each do |exception, _hits|
74
+ Byebug.catchpoints.each_key do |exception|
73
75
  puts("#{exception}: #{exception.is_a?(Class)}")
74
76
  end
75
77
  else
76
- puts 'No exceptions set to be caught.'
78
+ puts "No exceptions set to be caught."
77
79
  end
78
80
  end
79
81
  end
@@ -1,5 +1,7 @@
1
- require 'byebug/command'
2
- require 'byebug/helpers/parse'
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/command"
4
+ require "byebug/helpers/parse"
3
5
 
4
6
  module Byebug
5
7
  #
@@ -17,7 +19,7 @@ module Byebug
17
19
  end
18
20
 
19
21
  def self.description
20
- <<-EOD
22
+ <<-DESCRIPTION
21
23
  cond[ition] <n>[ expr]
22
24
 
23
25
  #{short_description}
@@ -26,27 +28,27 @@ module Byebug
26
28
  an integer and <expr> is an expression to be evaluated whenever
27
29
  breakpoint <n> is reached. If no expression is specified, the condition
28
30
  is removed.
29
- EOD
31
+ DESCRIPTION
30
32
  end
31
33
 
32
34
  def self.short_description
33
- 'Sets conditions on breakpoints'
35
+ "Sets conditions on breakpoints"
34
36
  end
35
37
 
36
38
  def execute
37
39
  return puts(help) unless @match[1]
38
40
 
39
41
  breakpoints = Byebug.breakpoints.sort_by(&:id)
40
- return errmsg(pr('condition.errors.no_breakpoints')) if breakpoints.empty?
42
+ return errmsg(pr("condition.errors.no_breakpoints")) if breakpoints.empty?
41
43
 
42
- pos, err = get_int(@match[1], 'Condition', 1)
44
+ pos, err = get_int(@match[1], "Condition", 1)
43
45
  return errmsg(err) if err
44
46
 
45
47
  breakpoint = breakpoints.find { |b| b.id == pos }
46
- return errmsg(pr('break.errors.no_breakpoint')) unless breakpoint
48
+ return errmsg(pr("break.errors.no_breakpoint")) unless breakpoint
47
49
 
48
50
  unless syntax_valid?(@match[2])
49
- return errmsg(pr('break.errors.not_changed', expr: @match[2]))
51
+ return errmsg(pr("break.errors.not_changed", expr: @match[2]))
50
52
  end
51
53
 
52
54
  breakpoint.expr = @match[2]