class RubyBreaker::TypeDefs::Type

This class is a catch-all. The constructor of this class must be called from children via super() in order to assign the position field variable.

The optional arguments are args = file name args = line number

args[2] = column position

or

args[0] = a Position, ObjectPosition, or Context object

Attributes

ctx[RW]

Speficies the context of the type.

Public Class Methods

new(*args) click to toggle source
# File lib/rubybreaker/type/type.rb, line 47
def initialize(*args)
  case args[0]
  when Context
    @ctx = args[0]
  when Position
    @ctx = Context.new(args[0])
  when ObjectPosition
    @ctx = Context.new(args[0])
  else
    file = args[0]
    line = args[1]
    col = args[2]
    pos = Position.new(file,line,col)
    @ctx = Context.new(pos)
  end
end

Public Instance Methods

eql?(other) click to toggle source

This method compares this object to another object syntactically.

# File lib/rubybreaker/type/type_comparer.rb, line 139
def eql?(other)
  TypeComparer.compare(self, other)
end
subtype_of?(rhs) click to toggle source

This is a shorthand for calling Typing.subtype_rel?

# File lib/rubybreaker/typing/subtyping.rb, line 480
def subtype_of?(rhs)
  return Typing.subtype_rel?(self,rhs)
end
unparse(opts={}) click to toggle source

This method is a shorthand for calling TypeUnparser.unparse(t).

# File lib/rubybreaker/type/type_unparser.rb, line 176
def unparse(opts={})
  TypeUnparser.unparse(self, opts)
end