Class: MilkTea::Types::StructHandle

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(struct_type, declaration) ⇒ StructHandle

Returns a new instance of StructHandle.



254
255
256
257
258
259
# File 'lib/milk_tea/core/types/types.rb', line 254

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

Instance Attribute Details

#declarationObject (readonly)

Returns the value of attribute declaration.



252
253
254
# File 'lib/milk_tea/core/types/types.rb', line 252

def declaration
  @declaration
end

#hashObject (readonly)

Returns the value of attribute hash.



267
268
269
# File 'lib/milk_tea/core/types/types.rb', line 267

def hash
  @hash
end

#struct_typeObject (readonly)

Returns the value of attribute struct_type.



252
253
254
# File 'lib/milk_tea/core/types/types.rb', line 252

def struct_type
  @struct_type
end

Instance Method Details

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

Returns:

  • (Boolean)


261
262
263
# File 'lib/milk_tea/core/types/types.rb', line 261

def eql?(other)
  other.is_a?(StructHandle) && other.struct_type == struct_type
end

#to_sObject



270
271
272
# File 'lib/milk_tea/core/types/types.rb', line 270

def to_s
  "field target #{struct_type}"
end