Class: Byebug::SkipCommand
Overview
Allows the user to continue execution until the next breakpoint, as long as it is different from the current one
Class Attribute Summary collapse
Attributes inherited from Command
#processor
Class Method Summary
collapse
Instance Method Summary
collapse
#get_int, #parse_steps, #syntax_valid?
Methods inherited from Command
#arguments, columnize, #context, #frame, help, #initialize, match, to_s
#camelize, #deindent, #prettify
Class Attribute Details
.file_line ⇒ Object
18
19
20
|
# File 'lib/byebug/commands/skip.rb', line 18
def file_line
@file_line ||= 0
end
|
.file_path ⇒ Object
22
23
24
|
# File 'lib/byebug/commands/skip.rb', line 22
def file_path
@file_path ||= ""
end
|
.previous_autolist ⇒ Object
Returns the value of attribute previous_autolist.
16
17
18
|
# File 'lib/byebug/commands/skip.rb', line 16
def previous_autolist
@previous_autolist
end
|
Class Method Details
.description ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/byebug/commands/skip.rb', line 41
def self.description
<<-DESCRIPTION
sk[ip]
#{short_description}
DESCRIPTION
end
|
.regexp ⇒ Object
37
38
39
|
# File 'lib/byebug/commands/skip.rb', line 37
def self.regexp
/^\s* sk(?:ip)? \s*$/x
end
|
.restore_autolist ⇒ Object
31
32
33
34
|
# File 'lib/byebug/commands/skip.rb', line 31
def restore_autolist
ListCommand.always_run = @previous_autolist
@previous_autolist = nil
end
|
.setup_autolist(value) ⇒ Object
.short_description ⇒ Object
49
50
51
|
# File 'lib/byebug/commands/skip.rb', line 49
def self.short_description
"Runs until the next breakpoint as long as it is different from the current one"
end
|
Instance Method Details
#auto_run ⇒ Object
70
71
72
73
74
75
|
# File 'lib/byebug/commands/skip.rb', line 70
def auto_run
return false unless self.class.always_run == 2
keep_execution ? processor.proceed! : reset_attributes
true
end
|
#execute ⇒ Object
77
78
79
80
81
82
83
|
# File 'lib/byebug/commands/skip.rb', line 77
def execute
return if auto_run
initialize_attributes
processor.proceed!
Byebug.stop if Byebug.stoppable?
end
|
#initialize_attributes ⇒ Object
53
54
55
56
57
58
|
# File 'lib/byebug/commands/skip.rb', line 53
def initialize_attributes
self.class.always_run = 2
self.class.setup_autolist(0)
self.class.file_path = frame.file
self.class.file_line = frame.line
end
|
#keep_execution ⇒ Object
60
61
62
|
# File 'lib/byebug/commands/skip.rb', line 60
def keep_execution
[self.class.file_path, self.class.file_line] == [frame.file, frame.line]
end
|
#reset_attributes ⇒ Object
64
65
66
67
68
|
# File 'lib/byebug/commands/skip.rb', line 64
def reset_attributes
self.class.always_run = 0
ListCommand.new(processor).execute if self.class.previous_autolist == 1
self.class.restore_autolist
end
|