Method: Puppet::Pops::Types::PObjectType::PAnnotatedMember#invoke

Defined in:
lib/puppet/pops/types/p_object_type.rb

#invoke(receiver, scope, args, &block) ⇒ 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.

Performs type checking of arguments and invokes the method that corresponds to this method. The result of the invocation is returned

Raises:

  • (ArgumentError)


251
252
253
254
255
256
257
258
259
# File 'lib/puppet/pops/types/p_object_type.rb', line 251

def invoke(receiver, scope, args, &block)
  @dispatch ||= create_dispatch(receiver)

  args_type = TypeCalculator.infer_set(block_given? ? args + [block] : args)
  found = @dispatch.find { |d| d.type.callable?(args_type) }
  raise ArgumentError, TypeMismatchDescriber.describe_signatures(label, @dispatch, args_type) if found.nil?

  found.invoke(receiver, scope, args, &block)
end