Class: Byebug::FinishCommand
Overview
Implements byebug’s ‘finish’ command.
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match
Class Method Details
.description ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/byebug/commands/finish.rb', line 27
def description
%{fin[ish][ n_frames]\tExecute until frame returns.
If no number is given, we run until the current frame returns. If a
number of frames `n_frames` is given, then we run until `n_frames`
return from the current position.}
end
|
.names ⇒ Object
23
24
25
|
# File 'lib/byebug/commands/finish.rb', line 23
def names
%w(finish)
end
|
Instance Method Details
#execute ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/byebug/commands/finish.rb', line 11
def execute
max_frames = Context.stack_size - @state.frame_pos
n_frames = get_int(@match[1], 'finish', 0, max_frames - 1, 1)
return nil unless n_frames
force = n_frames == 0 ? true : false
@state.context.step_out(@state.frame_pos + n_frames, force)
@state.frame_pos = 0
@state.proceed
end
|
#regexp ⇒ Object
7
8
9
|
# File 'lib/byebug/commands/finish.rb', line 7
def regexp
/^\s* fin(?:ish)? (?:\s+(\S+))? \s*$/x
end
|