class Yadriggy::TypeChecker::TypeDef

Type definition. It expresses a class (or singular class) definition. It maps an instance variable name or a method name to its type.

@see TypeChecker#typedef @see TypeChecker#add_typedef

Public Class Methods

new() click to toggle source
# File lib/yadriggy/typecheck.rb, line 134
def initialize()
  @names = {}
end

Public Instance Methods

[](name) click to toggle source

Gets the type of an instance variable or a method. @param [String|Symbol] name its name.

`name` can be any object with `to_sym`.

@return [Type|nil] its type.

# File lib/yadriggy/typecheck.rb, line 142
def [](name)
  @names[name.to_sym]
end
[]=(name, type) click to toggle source

Adds an instance variable or a method. @param [String|Symbol] name its name.

`name` can be any object with `to_sym`.

@param [Type] type its type. @return [Type] the added type.

# File lib/yadriggy/typecheck.rb, line 151
def []=(name, type)
  @names[name.to_sym] = type
end