Class: Tapioca::TypeMember
- Inherits:
-
T::Types::TypeMember
- Object
- T::Types::TypeMember
- Tapioca::TypeMember
- Extended by:
- T::Sig
- Defined in:
- lib/tapioca/sorbet_ext/generic_name_patch.rb
Instance Attribute Summary collapse
-
#fixed ⇒ Object
readonly
Returns the value of attribute fixed.
-
#lower ⇒ Object
readonly
Returns the value of attribute lower.
-
#name ⇒ Object
Returns the value of attribute name.
-
#upper ⇒ Object
readonly
Returns the value of attribute upper.
Instance Method Summary collapse
-
#initialize(variance, fixed, lower, upper) ⇒ TypeMember
constructor
A new instance of TypeMember.
- #serialize ⇒ Object
Constructor Details
#initialize(variance, fixed, lower, upper) ⇒ TypeMember
Returns a new instance of TypeMember.
79 80 81 82 83 84 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 79 def initialize(variance, fixed, lower, upper) super(variance) @fixed = fixed @lower = lower @upper = upper end |
Instance Attribute Details
#fixed ⇒ Object (readonly)
Returns the value of attribute fixed.
76 77 78 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 76 def fixed @fixed end |
#lower ⇒ Object (readonly)
Returns the value of attribute lower.
76 77 78 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 76 def lower @lower end |
#name ⇒ Object
Returns the value of attribute name.
73 74 75 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 73 def name @name end |
#upper ⇒ Object (readonly)
Returns the value of attribute upper.
76 77 78 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 76 def upper @upper end |
Instance Method Details
#serialize ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 87 def serialize parts = [] parts << ":#{@variance}" unless @variance == :invariant parts << "fixed: #{@fixed}" if @fixed parts << "lower: #{@lower}" unless @lower == T.untyped parts << "upper: #{@upper}" unless @upper == BasicObject parameters = parts.join(", ") serialized = +"type_member" serialized << "(#{parameters})" unless parameters.empty? serialized end |