Class: MilkTea::Types::CallableHandle

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(display_name, declaration) ⇒ CallableHandle

Returns a new instance of CallableHandle.



303
304
305
306
307
308
# File 'lib/milk_tea/core/types/types.rb', line 303

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

Instance Attribute Details

#declarationObject (readonly)

Returns the value of attribute declaration.



301
302
303
# File 'lib/milk_tea/core/types/types.rb', line 301

def declaration
  @declaration
end

#display_nameObject (readonly)

Returns the value of attribute display_name.



301
302
303
# File 'lib/milk_tea/core/types/types.rb', line 301

def display_name
  @display_name
end

#hashObject (readonly)

Returns the value of attribute hash.



316
317
318
# File 'lib/milk_tea/core/types/types.rb', line 316

def hash
  @hash
end

Instance Method Details

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

Returns:

  • (Boolean)


310
311
312
# File 'lib/milk_tea/core/types/types.rb', line 310

def eql?(other)
  other.is_a?(CallableHandle) && other.display_name == display_name
end

#to_sObject



319
320
321
# File 'lib/milk_tea/core/types/types.rb', line 319

def to_s
  "callable_of(#{display_name})"
end