Class: MilkTea::Types::Proc
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
Instance Method Summary collapse
- #children ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(params:, return_type:) ⇒ Proc
constructor
A new instance of Proc.
- #to_s ⇒ Object
Methods inherited from Base
#accept, #bitwise?, #boolean?, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?
Constructor Details
#initialize(params:, return_type:) ⇒ Proc
Returns a new instance of Proc.
1361 1362 1363 1364 1365 1366 |
# File 'lib/milk_tea/core/types.rb', line 1361 def initialize(params:, return_type:) @params = params.freeze @return_type = return_type @hash = [self.class, @params, return_type].hash freeze end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
1374 1375 1376 |
# File 'lib/milk_tea/core/types.rb', line 1374 def hash @hash end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
1359 1360 1361 |
# File 'lib/milk_tea/core/types.rb', line 1359 def params @params end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
1359 1360 1361 |
# File 'lib/milk_tea/core/types.rb', line 1359 def return_type @return_type end |
Instance Method Details
#children ⇒ Object
1380 1381 1382 |
# File 'lib/milk_tea/core/types.rb', line 1380 def children params.map(&:type) + [return_type] end |
#eql?(other) ⇒ Boolean Also known as: ==
1368 1369 1370 |
# File 'lib/milk_tea/core/types.rb', line 1368 def eql?(other) other.is_a?(Proc) && other.params == params && other.return_type == return_type end |
#to_s ⇒ Object
1376 1377 1378 |
# File 'lib/milk_tea/core/types.rb', line 1376 def to_s "proc(#{params.map(&:type).join(', ')}) -> #{return_type}" end |