Class: MilkTea::Types::GenericInstance
- Defined in:
- lib/milk_tea/core/types/types.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #children ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(name, arguments) ⇒ GenericInstance
constructor
A new instance of GenericInstance.
- #to_s ⇒ Object
Methods inherited from Base
#accept, #bitwise?, #boolean?, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?
Constructor Details
#initialize(name, arguments) ⇒ GenericInstance
Returns a new instance of GenericInstance.
439 440 441 442 443 444 |
# File 'lib/milk_tea/core/types/types.rb', line 439 def initialize(name, arguments) @name = name @arguments = arguments.freeze @hash = [self.class, name, @arguments].hash freeze end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
437 438 439 |
# File 'lib/milk_tea/core/types/types.rb', line 437 def arguments @arguments end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
452 453 454 |
# File 'lib/milk_tea/core/types/types.rb', line 452 def hash @hash end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
437 438 439 |
# File 'lib/milk_tea/core/types/types.rb', line 437 def name @name end |
Instance Method Details
#children ⇒ Object
458 459 460 |
# File 'lib/milk_tea/core/types/types.rb', line 458 def children arguments.reject { |a| a.is_a?(Types::LiteralTypeArg) } end |
#eql?(other) ⇒ Boolean Also known as: ==
446 447 448 |
# File 'lib/milk_tea/core/types/types.rb', line 446 def eql?(other) other.is_a?(GenericInstance) && other.name == name && other.arguments == arguments end |
#to_s ⇒ Object
454 455 456 |
# File 'lib/milk_tea/core/types/types.rb', line 454 def to_s "#{name}[#{arguments.join(', ')}]" end |