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.
1356 1357 1358 1359 1360 1361 |
# File 'lib/milk_tea/core/types.rb', line 1356 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.
1369 1370 1371 |
# File 'lib/milk_tea/core/types.rb', line 1369 def hash @hash end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
1354 1355 1356 |
# File 'lib/milk_tea/core/types.rb', line 1354 def params @params end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
1354 1355 1356 |
# File 'lib/milk_tea/core/types.rb', line 1354 def return_type @return_type end |
Instance Method Details
#children ⇒ Object
1375 1376 1377 |
# File 'lib/milk_tea/core/types.rb', line 1375 def children params.map(&:type) + [return_type] end |
#eql?(other) ⇒ Boolean Also known as: ==
1363 1364 1365 |
# File 'lib/milk_tea/core/types.rb', line 1363 def eql?(other) other.is_a?(Proc) && other.params == params && other.return_type == return_type end |
#to_s ⇒ Object
1371 1372 1373 |
# File 'lib/milk_tea/core/types.rb', line 1371 def to_s "proc(#{params.map(&:type).join(', ')}) -> #{return_type}" end |