Class: Byebug::FrameCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/frame.rb

Overview

Move to specific frames in the backtrace.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/byebug/commands/frame.rb', line 258

def description
  %(f[rame][ frame-number]

    Move the current frame to the specified frame number, or the 0 if no
    frame-number has been given.

    A negative number indicates position from the other end, so
    "frame -1" moves to the oldest frame, and "frame 0" moves to the
    newest frame.

    Without an argument, the command prints the current stack frame. Since
    the current position is redisplayed, it may trigger a resyncronization
    if there is a front end also watching over things.)
end

.namesObject



254
255
256
# File 'lib/byebug/commands/frame.rb', line 254

def names
  %w(frame)
end

Instance Method Details

#executeObject



244
245
246
247
248
249
250
251
# File 'lib/byebug/commands/frame.rb', line 244

def execute
  return print_frame @state.frame_pos unless @match[1]

  pos, err = get_int(@match[1], 'Frame')
  return errmsg(err) unless pos

  adjust_frame(pos, true)
end

#regexpObject



240
241
242
# File 'lib/byebug/commands/frame.rb', line 240

def regexp
  /^\s* f(?:rame)? (?:\s+(\S+))? \s*$/x
end