class RubyBreaker::Position

This class represents a position of the type acquired from either the type signature or code during runtime. It can also be used for internal error checking or debuging purpose.

Attributes

col[RW]
file[RW]
line[RW]
method[RW]

Public Class Methods

convert_caller_to_pos(caller_ary, idx=0) click to toggle source

This class method is a utility function to convert a string in the caller() array.

# File lib/rubybreaker/debug/context.rb, line 49
def self.convert_caller_to_pos(caller_ary, idx=0)
  tokens = caller_ary[idx].split(":")
  return self.new(tokens[0],tokens[1],-1,tokens[2]) # no col
end
get() click to toggle source

This class method returns a new position object for the current parsing position.

# File lib/rubybreaker/debug/context.rb, line 43
def self.get()
  return Position.new(@@file,@@line,@@col)
end
new(file="",line=-1,col=-1,meth="") click to toggle source
# File lib/rubybreaker/debug/context.rb, line 23
def initialize(file="",line=-1,col=-1,meth="")
  @file = file
  @line = line
  @col = col
  @method = meth
end
set(file,line,col) click to toggle source

This class method is to set the current parsing position.

# File lib/rubybreaker/debug/context.rb, line 35
def self.set(file,line,col)
  @@file = file
  @@line = line
  @@col = col
end

Public Instance Methods

to_s() click to toggle source
# File lib/rubybreaker/debug/context.rb, line 30
def to_s()
  return "#{@file}:(#{@line},#{@col}):in #{@method}"
end