Class: MilkTea::Types::Null

Inherits:
Base
  • Object
show all
Defined in:
lib/milk_tea/core/types/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hashObject (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_typeObject (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

#childrenObject



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: ==

Returns:

  • (Boolean)


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_sObject



226
227
228
# File 'lib/milk_tea/core/types/types.rb', line 226

def to_s
  target_type ? "null[#{target_type}]" : "null"
end