Module: RBS::Types::_TypeBase
- Includes:
- _ToJson
- Included in:
- Alias, Bases::Base, ClassInstance, ClassSingleton, Interface, Intersection, Literal, Optional, Proc, Record, Tuple, Union, Variable
- Defined in:
- sig/types.rbs
Overview
_TypeBase interface represents the operations common to all of the types.
Instance Method Summary collapse
-
#each_type {|arg0| ... } ⇒ Object
Yields all direct sub types included in the type.
-
#free_variables ⇒ Set[Symbol]
Returns names of free variables of a type.
-
#has_classish_type? ⇒ Boolean
Returns
trueif it hasinstanceorclasstypes. -
#has_self_type? ⇒ Boolean
Returns
trueif it hasselftype. -
#map_type_name {|arg0, arg1, arg2| ... } ⇒ t
Maps type names included in the type and returns new instance of type.
-
#sub ⇒ t
Receives a substitution and returns a new type applied the substitution.
-
#to_s ⇒ String
Returns a String representation.
-
#with_nonreturn_void? ⇒ Boolean
Returns
trueif it hasvoidtypes other than return position.
Instance Method Details
#each_type ⇒ void #each_type ⇒ Enumerator[t, void]
Yields all direct sub types included in the type. It doesn't yield the type itself.
parse("Hash[String, Array[Symbol]]").each_type do |ty|
... # Yields String and Array[Symbol]
end
27 28 |
# File 'sig/types.rbs', line 27
def each_type: () { (t) -> void } -> void
| () -> Enumerator[t, void]
|
#free_variables ⇒ Set[Symbol]
Returns names of free variables of a type. You can pass a Set instance to add the free variables to the set to avoid Set object allocation.
9 |
# File 'sig/types.rbs', line 9
def free_variables: (?Set[Symbol]) -> Set[Symbol]
|
#has_classish_type? ⇒ Boolean
Returns true if it has instance or class types
50 |
# File 'sig/types.rbs', line 50
def has_classish_type?: () -> bool
|
#has_self_type? ⇒ Boolean
Returns true if it has self type
47 |
# File 'sig/types.rbs', line 47
def has_self_type?: () -> bool
|
#map_type_name {|arg0, arg1, arg2| ... } ⇒ t
Maps type names included in the type and returns new instance of type.
16 |
# File 'sig/types.rbs', line 16
def map_type_name: () { (TypeName, Location[untyped, untyped]?, t) -> TypeName } -> t
|
#sub ⇒ t
Receives a substitution and returns a new type applied the substitution.
13 |
# File 'sig/types.rbs', line 13
def sub: (Substitution) -> t
|
#to_s ⇒ String
Returns a String representation.
level is used internally.
parse("String").to_s # => "String"
parse("String | Integer").to_s() # => "String | Integer"
parse("String | Integer").to_s(1) # => "(String | Integer)"
43 |
# File 'sig/types.rbs', line 43
def to_s: (?Integer level) -> String
|
#with_nonreturn_void? ⇒ Boolean
Returns true if it has void types other than return position
- The function return type is a return position (
() -> void) - Generic parameter is a return position (
Enumerator[Integer, void])
57 |
# File 'sig/types.rbs', line 57
def with_nonreturn_void?: () -> bool
|