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.
134 135 136 |
# File 'lib/yadriggy/typecheck.rb', line 134 def initialize() @names = {} end |
Instance Method Details
#[](name) ⇒ Type|nil
Gets the type of an instance variable or a method.
142 143 144 |
# File 'lib/yadriggy/typecheck.rb', line 142 def [](name) @names[name.to_sym] end |
#[]=(name, type) ⇒ Type
Adds an instance variable or a method.
151 152 153 |
# File 'lib/yadriggy/typecheck.rb', line 151 def []=(name, type) @names[name.to_sym] = type end |