Class: MilkTea::Types::TypeVar

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?, #children, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?

Constructor Details

#initialize(name) ⇒ TypeVar

Returns a new instance of TypeVar.



466
467
468
469
# File 'lib/milk_tea/core/types/types.rb', line 466

def initialize(name)
  @name = name
  freeze
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



464
465
466
# File 'lib/milk_tea/core/types/types.rb', line 464

def name
  @name
end

Instance Method Details

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

Returns:

  • (Boolean)


471
472
473
# File 'lib/milk_tea/core/types/types.rb', line 471

def eql?(other)
  other.is_a?(TypeVar) && other.name == name
end

#hashObject



477
478
479
480
# File 'lib/milk_tea/core/types/types.rb', line 477

def hash

  @name.hash
end

#to_sObject



483
484
485
# File 'lib/milk_tea/core/types/types.rb', line 483

def to_s
  name
end