Class: RBI::Type::TypeAlias
- Inherits:
-
Type
- Object
- Type
- RBI::Type::TypeAlias
- Defined in:
- lib/rbi/type.rb
Overview
A type alias that references another type by name like MyTypeAlias.
Instance Attribute Summary collapse
- #aliased_type ⇒ Object readonly
- #name ⇒ Object readonly
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, aliased_type) ⇒ TypeAlias
constructor
A new instance of TypeAlias.
- #normalize ⇒ Object
- #simplify ⇒ Object
- #to_rbi ⇒ Object
Constructor Details
#initialize(name, aliased_type) ⇒ TypeAlias
Returns a new instance of TypeAlias.
631 632 633 634 635 |
# File 'lib/rbi/type.rb', line 631 def initialize(name, aliased_type) super() @name = name @aliased_type = aliased_type end |
Instance Attribute Details
#aliased_type ⇒ Object (readonly)
628 629 630 |
# File 'lib/rbi/type.rb', line 628 def aliased_type @aliased_type end |
#name ⇒ Object (readonly)
625 626 627 |
# File 'lib/rbi/type.rb', line 625 def name @name end |
Instance Method Details
#==(other) ⇒ Object
639 640 641 |
# File 'lib/rbi/type.rb', line 639 def ==(other) TypeAlias === other && @name == other.name && @aliased_type == other.aliased_type end |
#normalize ⇒ Object
651 652 653 |
# File 'lib/rbi/type.rb', line 651 def normalize TypeAlias.new(name, aliased_type.normalize) end |
#simplify ⇒ Object
657 658 659 |
# File 'lib/rbi/type.rb', line 657 def simplify TypeAlias.new(name, aliased_type.simplify) end |
#to_rbi ⇒ Object
645 646 647 |
# File 'lib/rbi/type.rb', line 645 def to_rbi "#{name} = ::T.type_alias { #{aliased_type.to_rbi} }" end |