Sha256: d70642bc651f96a4103ac179c9f9f4171890ba792635149445c15dc65d71ee3d

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

module Byebug

  class << self

    # interface modules provide +handler+ object
    attr_accessor :handler

  end

  class Context
    def frame_args(frame_no=0)
      bind = frame_binding(frame_no)
      return [] unless eval "__method__", bind
      begin
        eval "self.method(__method__).parameters.map{|(attr, mid)| mid}", bind
      rescue NameError => e
        print "(WARNING: retreving args from frame #{frame_no} => " \
              "#{e.class} Exception: #{e.message})\n     "
        return []
      end
    end

    def handler
      Byebug.handler or raise 'No interface loaded'
    end

    def at_breakpoint(breakpoint)
      handler.at_breakpoint(self, breakpoint)
    end

    def at_catchpoint(excpt)
      handler.at_catchpoint(self, excpt)
    end

    def at_tracing(file, line)
      handler.at_tracing(self, file, line)
    end

    def at_line(file, line)
      handler.at_line(self, file, line) unless
        defined?(Byebug::BYEBUG_SCRIPT) and
        File.identical?(file, Byebug::BYEBUG_SCRIPT)
    end

    #def at_return(file, line)
    #  handler.at_return(self, file, line)
    #end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
byebug-1.3.0 lib/byebug/context.rb
byebug-1.2.0 lib/byebug/context.rb