Method: Puppet::Pops::Functions::Dispatcher#to_type

Defined in:
lib/puppet/pops/functions/dispatcher.rb

#to_typeObject

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.

Produces a CallableType for a single signature, and a Variant otherwise



60
61
62
63
64
65
66
67
68
69
# File 'lib/puppet/pops/functions/dispatcher.rb', line 60

def to_type()
  # make a copy to make sure it can be contained by someone else (even if it is not contained here, it
  # should be treated as immutable).
  #
  callables = dispatchers.map { | dispatch | dispatch.type }

  # multiple signatures, produce a Variant type of Callable1-n (must copy them)
  # single signature, produce single Callable
  callables.size > 1 ?  Puppet::Pops::Types::TypeFactory.variant(*callables) : callables.pop
end