Class: Literal::Types::NilableType Private
- Inherits:
-
Object
- Object
- Literal::Types::NilableType
- Includes:
- Literal::Type
- Defined in:
- lib/literal/types/nilable_type.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #type ⇒ Object readonly private
Instance Method Summary collapse
- #===(value) ⇒ Object private
- #>=(other) ⇒ Object private
-
#initialize(type) ⇒ NilableType
constructor
private
A new instance of NilableType.
- #inspect ⇒ Object private
- #record_literal_type_errors(ctx) ⇒ Object private
Constructor Details
#initialize(type) ⇒ NilableType
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of NilableType.
7 8 9 10 |
# File 'lib/literal/types/nilable_type.rb', line 7 def initialize(type) @type = type freeze end |
Instance Attribute Details
#type ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/literal/types/nilable_type.rb', line 12 def type @type end |
Instance Method Details
#===(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/literal/types/nilable_type.rb', line 18 def ===(value) nil === value || @type === value end |
#>=(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/literal/types/nilable_type.rb', line 26 def >=(other) case other when Literal::Types::NilableType Literal.subtype?(other.type, @type) when nil true else Literal.subtype?(other, @type) end end |
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/literal/types/nilable_type.rb', line 14 def inspect "_Nilable(#{@type.inspect})" end |
#record_literal_type_errors(ctx) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 |
# File 'lib/literal/types/nilable_type.rb', line 22 def record_literal_type_errors(ctx) @type.record_literal_type_errors(ctx) if @type.respond_to?(:record_literal_type_errors) end |