Method: Puppet::Pops::Types::PCallableType#callable_with?

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

#callable_with?(args, block = nil) ⇒ Boolean

Returns true if this instance is a callable that accepts the given args

Parameters:

  • args (Array)

    the arguments to test

Returns:

  • (Boolean)

    true if this instance is a callable that accepts the given args



2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
# File 'lib/puppet/pops/types/types.rb', line 2331

def callable_with?(args, block = nil)
  # nil param_types and compatible return type means other Callable is assignable
  return true if @param_types.nil?
  return false unless @param_types.instance?(args)
  if @block_type.nil?
    block == nil
  else
    @block_type.instance?(block)
  end
end