Sha256: da287900e353e28af4ddd7fb5beba53501d0e6675c180284bc0a0c7595f4757a

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

module Byebug
  #
  # Implements breakpoints
  #
  class Breakpoint
    #
    # First breakpoint, in order of creation
    #
    def self.first
      Byebug.breakpoints.first
    end

    #
    # Last breakpoint, in order of creation
    #
    def self.last
      Byebug.breakpoints.last
    end

    #
    # Adds a new breakpoint
    #
    # @param [String] file
    # @param [Fixnum] line
    # @param [String] expr
    #
    def self.add(file, line, expr = nil)
      breakpoint = Breakpoint.new(file, line, expr)
      Byebug.breakpoints << breakpoint
      breakpoint
    end

    #
    # Removes a breakpoint
    #
    # @param [integer] breakpoint number
    #
    def self.remove(id)
      Byebug.breakpoints.reject! { |b| b.id == id }
    end

    #
    # True if there's no breakpoints
    #
    def self.none?
      Byebug.breakpoints.empty?
    end

    #
    # Prints all information associated to the breakpoint
    #
    def inspect
      meths = %w(id pos source expr hit_condition hit_count hit_value enabled?)
      values = meths.map do |field|
        "#{field}: #{send(field)}"
      end.join(', ')
      "#<Byebug::Breakpoint #{values}>"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
byebug-3.5.1 lib/byebug/breakpoint.rb
byebug-3.5.0 lib/byebug/breakpoint.rb
byebug-3.4.2 lib/byebug/breakpoint.rb
byebug-3.4.1 lib/byebug/breakpoint.rb
byebug-3.4.0 lib/byebug/breakpoint.rb
byebug-3.3.0 lib/byebug/breakpoint.rb