Class: Tapioca::TypeTemplate
- Inherits:
-
T::Types::TypeTemplate
- Object
- T::Types::TypeTemplate
- Tapioca::TypeTemplate
- 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) ⇒ TypeTemplate
constructor
A new instance of TypeTemplate.
- #serialize ⇒ Object
Constructor Details
#initialize(variance, fixed, lower, upper) ⇒ TypeTemplate
Returns a new instance of TypeTemplate.
112 113 114 115 116 117 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 112 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.
109 110 111 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 109 def fixed @fixed end |
#lower ⇒ Object (readonly)
Returns the value of attribute lower.
109 110 111 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 109 def lower @lower end |
#name ⇒ Object
Returns the value of attribute name.
106 107 108 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 106 def name @name end |
#upper ⇒ Object (readonly)
Returns the value of attribute upper.
109 110 111 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 109 def upper @upper end |
Instance Method Details
#serialize ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/tapioca/sorbet_ext/generic_name_patch.rb', line 120 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_template" serialized << "(#{parameters})" unless parameters.empty? serialized end |