Class: Konpeito::TypeChecker::Types::NativeModuleType
- Defined in:
- lib/konpeito/type_checker/types.rb
Overview
NativeModule type - module with methods but no instance state Marked with @native annotation in RBS Can be included in classes to mix in methods
Instance Attribute Summary collapse
-
#methods ⇒ Object
readonly
Returns the value of attribute methods.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#native_array_fields ⇒ Object
readonly
Returns the value of attribute native_array_fields.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(name, methods = {}, native_array_fields: {}) ⇒ NativeModuleType
constructor
A new instance of NativeModuleType.
-
#lookup_method(method_name) ⇒ Object
Look up a method by name.
-
#lookup_native_array_field(field_name) ⇒ Object
Look up a NativeArray field by name.
- #to_s ⇒ Object
Methods inherited from Type
#eql?, #subtype_of?, #union?, #untyped?
Constructor Details
#initialize(name, methods = {}, native_array_fields: {}) ⇒ NativeModuleType
Returns a new instance of NativeModuleType.
1291 1292 1293 1294 1295 |
# File 'lib/konpeito/type_checker/types.rb', line 1291 def initialize(name, methods = {}, native_array_fields: {}) @name = name.to_sym @methods = methods @native_array_fields = native_array_fields end |
Instance Attribute Details
#methods ⇒ Object (readonly)
Returns the value of attribute methods.
1286 1287 1288 |
# File 'lib/konpeito/type_checker/types.rb', line 1286 def methods @methods end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
1286 1287 1288 |
# File 'lib/konpeito/type_checker/types.rb', line 1286 def name @name end |
#native_array_fields ⇒ Object (readonly)
Returns the value of attribute native_array_fields.
1286 1287 1288 |
# File 'lib/konpeito/type_checker/types.rb', line 1286 def native_array_fields @native_array_fields end |
Instance Method Details
#==(other) ⇒ Object
1307 1308 1309 1310 |
# File 'lib/konpeito/type_checker/types.rb', line 1307 def ==(other) return false unless other.is_a?(NativeModuleType) name == other.name end |
#hash ⇒ Object
1312 1313 1314 |
# File 'lib/konpeito/type_checker/types.rb', line 1312 def hash name.hash end |
#lookup_method(method_name) ⇒ Object
Look up a method by name
1298 1299 1300 |
# File 'lib/konpeito/type_checker/types.rb', line 1298 def lookup_method(method_name) @methods[method_name.to_sym] end |
#lookup_native_array_field(field_name) ⇒ Object
Look up a NativeArray field by name
1303 1304 1305 |
# File 'lib/konpeito/type_checker/types.rb', line 1303 def lookup_native_array_field(field_name) @native_array_fields[field_name.to_sym] end |
#to_s ⇒ Object
1316 1317 1318 |
# File 'lib/konpeito/type_checker/types.rb', line 1316 def to_s "NativeModule(#{name})" end |