class RubyBreaker::Context

This class represents a context which consists of one or more positions. A position can refer to a physical file/line position or a virtual position with respect to an object. A context is commonly used to represent a chain of positions for types.

Attributes

child[RW]
pos[RW]

Public Class Methods

new(pos) click to toggle source
# File lib/rubybreaker/debug/context.rb, line 81
def initialize(pos)
  @pos = pos
  @child = nil
end

Public Instance Methods

format_with_msg(pp,msg="") click to toggle source
# File lib/rubybreaker/debug/context.rb, line 104
def format_with_msg(pp,msg="")
  pp.text(@pos.to_s)
  pp.breakable()
  if @child
    pp.group(2) { 
      pp.breakable()
      @child.format_with_msg(pp,msg)
    }
  elsif msg != ""
    pp.group(2) do
      pp.breakable()
      pp.text("> #{msg}",79)
    end
  end
end
pop() click to toggle source
# File lib/rubybreaker/debug/context.rb, line 94
def pop
  if @child && @child.child
    @child.pop
  elsif @child
    @child = nil
  else 
    # root; don't do anything
  end
end
push(pos) click to toggle source
# File lib/rubybreaker/debug/context.rb, line 86
def push(pos)
  if @child 
    @child.push(pos)
  else
    @child = Context.new(pos)
  end
end