Class: MilkTea::Types::Nullable

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(base) ⇒ Nullable

Returns a new instance of Nullable.



391
392
393
394
395
# File 'lib/milk_tea/core/types/types.rb', line 391

def initialize(base)
  @base = base
  @hash = [self.class, base].hash
  freeze
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



389
390
391
# File 'lib/milk_tea/core/types/types.rb', line 389

def base
  @base
end

#hashObject (readonly)

Returns the value of attribute hash.



403
404
405
# File 'lib/milk_tea/core/types/types.rb', line 403

def hash
  @hash
end

Instance Method Details

#childrenObject



409
410
411
# File 'lib/milk_tea/core/types/types.rb', line 409

def children
  [base]
end

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


397
398
399
# File 'lib/milk_tea/core/types/types.rb', line 397

def eql?(other)
  other.is_a?(Nullable) && other.base == base
end

#to_sObject



405
406
407
# File 'lib/milk_tea/core/types/types.rb', line 405

def to_s
  "#{base}?"
end