Method: Puppet::Pops::Types::TypeCalculator#infer_Proc
- Defined in:
- lib/puppet/pops/types/type_calculator.rb
#infer_Proc(o) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
# File 'lib/puppet/pops/types/type_calculator.rb', line 589 def infer_Proc(o) min = 0 max = 0 mapped_types = o.parameters.map do |p| case p[0] when :rest max = :default break PAnyType::DEFAULT when :req min += 1 end max += 1 PAnyType::DEFAULT end param_types = Types::PTupleType.new(mapped_types, Types::PIntegerType.new(min, max)) Types::PCallableType.new(param_types) end |