Class: MilkTea::Types::Null
- Defined in:
- lib/milk_tea/core/types/types.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#target_type ⇒ Object
readonly
Returns the value of attribute target_type.
Instance Method Summary collapse
- #children ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(target_type = nil) ⇒ Null
constructor
A new instance of Null.
- #to_s ⇒ Object
Methods inherited from Base
#accept, #bitwise?, #boolean?, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?
Constructor Details
#initialize(target_type = nil) ⇒ Null
Returns a new instance of Null.
211 212 213 214 215 |
# File 'lib/milk_tea/core/types/types.rb', line 211 def initialize(target_type = nil) @target_type = target_type @hash = [self.class, target_type].hash freeze end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
223 224 225 |
# File 'lib/milk_tea/core/types/types.rb', line 223 def hash @hash end |
#target_type ⇒ Object (readonly)
Returns the value of attribute target_type.
209 210 211 |
# File 'lib/milk_tea/core/types/types.rb', line 209 def target_type @target_type end |
Instance Method Details
#children ⇒ Object
230 231 232 |
# File 'lib/milk_tea/core/types/types.rb', line 230 def children [target_type].compact end |
#eql?(other) ⇒ Boolean Also known as: ==
217 218 219 |
# File 'lib/milk_tea/core/types/types.rb', line 217 def eql?(other) other.is_a?(Null) && other.target_type == target_type end |
#to_s ⇒ Object
226 227 228 |
# File 'lib/milk_tea/core/types/types.rb', line 226 def to_s target_type ? "null[#{target_type}]" : "null" end |