Class: MilkTea::Types::Proc
- Defined in:
- lib/milk_tea/core/types/types.rb
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.
1367 1368 1369 1370 1371 1372 |
# File 'lib/milk_tea/core/types/types.rb', line 1367 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.
1380 1381 1382 |
# File 'lib/milk_tea/core/types/types.rb', line 1380 def hash @hash end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
1365 1366 1367 |
# File 'lib/milk_tea/core/types/types.rb', line 1365 def params @params end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
1365 1366 1367 |
# File 'lib/milk_tea/core/types/types.rb', line 1365 def return_type @return_type end |
Instance Method Details
#children ⇒ Object
1386 1387 1388 |
# File 'lib/milk_tea/core/types/types.rb', line 1386 def children params.map(&:type) + [return_type] end |
#eql?(other) ⇒ Boolean Also known as: ==
1374 1375 1376 |
# File 'lib/milk_tea/core/types/types.rb', line 1374 def eql?(other) other.is_a?(Proc) && other.params == params && other.return_type == return_type end |
#to_s ⇒ Object
1382 1383 1384 |
# File 'lib/milk_tea/core/types/types.rb', line 1382 def to_s "proc(#{params.map(&:type).join(', ')}) -> #{return_type}" end |