Class: Yadriggy::TypeChecker::TypeDef
- Inherits:
-
Object
- Object
- Yadriggy::TypeChecker::TypeDef
- Defined in:
- lib/yadriggy/typecheck.rb
Overview
Type definition. It expresses a class (or singular class) definition. It maps an instance variable name or a method name to its type.
Instance Method Summary collapse
-
#[](name) ⇒ Type|nil
Gets the type of an instance variable or a method.
-
#[]=(name, type) ⇒ Type
Adds an instance variable or a method.
-
#initialize ⇒ TypeDef
constructor
A new instance of TypeDef.
Constructor Details
#initialize ⇒ TypeDef
Returns a new instance of TypeDef.
131 132 133 |
# File 'lib/yadriggy/typecheck.rb', line 131 def initialize() @names = {} end |
Instance Method Details
#[](name) ⇒ Type|nil
Gets the type of an instance variable or a method.
139 140 141 |
# File 'lib/yadriggy/typecheck.rb', line 139 def [](name) @names[name.to_sym] end |
#[]=(name, type) ⇒ Type
Adds an instance variable or a method.
148 149 150 |
# File 'lib/yadriggy/typecheck.rb', line 148 def []=(name, type) @names[name.to_sym] = type end |