# class Byebug::FinishCommand

Implements the finish functionality.

Allows the user to continue execution until certain frames are finished.

### Public Class Methods

description() click to toggle source

    # File lib/byebug/commands/finish.rb, line 21
        def self.description
          <<-DESCRIPTION
            fin[ish][ n_frames]

            #{short_description}

            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.
          DESCRIPTION
        end

regexp() click to toggle source

    # File lib/byebug/commands/finish.rb, line 17
    def self.regexp
      /^\s* fin(?:ish)? (?:\s+(\S+))? \s*$/x
    end

short_description() click to toggle source

    # File lib/byebug/commands/finish.rb, line 33
    def self.short_description
      "Runs the program until frame returns"
    end

### Public Instance Methods

execute() click to toggle source

    # File lib/byebug/commands/finish.rb, line 37
    def execute
      if @match[1]
        n_frames, err = get_int(@match[1], "finish", 0, max_frames - 1)
        return errmsg(err) unless n_frames
      else
        n_frames = 1
      end

      force = n_frames.zero? ? true : false
      context.step_out(context.frame.pos + n_frames, force)
      context.frame = 0
      processor.proceed!
    end

### Private Instance Methods

max_frames() click to toggle source

    # File lib/byebug/commands/finish.rb, line 53
    def max_frames
      context.stack_size - context.frame.pos
    end