lib/puppet/functions.rb
def block_param(*type_and_name)
      case type_and_name.size
      when 0
        type = @all_callables
        name = :block
      when 1
        type = @all_callables
        name = type_and_name[0]
      when 2
        type_string, name = type_and_name
        type = Puppet::Pops::Types::TypeParser.singleton.parse(type_string, loader)
      else
        raise ArgumentError, _("block_param accepts max 2 arguments (type, name), got %{size}.") % { size: type_and_name.size }
      end

      unless Puppet::Pops::Types::TypeCalculator.is_kind_of_callable?(type, false)
        raise ArgumentError, _("Expected PCallableType or PVariantType thereof, got %{type_class}") % { type_class: type.class }
      end

      unless name.is_a?(Symbol)
        raise ArgumentError, _("Expected block_param name to be a Symbol, got %{name_class}") % { name_class: name.class }
      end

      if @block_type.nil?
        @block_type = type
        @block_name = name
      else
        raise ArgumentError, _('Attempt to redefine block')
      end
    end
# Defines one required block parameter that may appear last. If type and name is missing the
# default type is "Callable", and the name is "block". If only one
# parameter is given, then that is the name and the type is "Callable".
#
# @api public
Defines one required block parameter that may appear last. If type and name is missing the
default type is "Callable", and the name is "block". If only one
parameter is given, then that is the name and the type is "Callable".
Defines one required block parameter that may appear last . If type and name is missing the default type is " Callable " and the name is " block " . If only one parameter is given then that is the name and the type is " Callable " .
def block_param(*type_and_name)
      case type_and_name.size
      when 0
        type = @all_callables
        name = :block
      when 1
        type = @all_callables
        name = type_and_name[0]
      when 2
        type_string, name = type_and_name
        type = Puppet::Pops::Types::TypeParser.singleton.parse(type_string, loader)
      else
        raise ArgumentError, _("block_param accepts max 2 arguments (type, name), got %{size}.") % { size: type_and_name.size }
      end
      unless Puppet::Pops::Types::TypeCalculator.is_kind_of_callable?(type, false)
        raise ArgumentError, _("Expected PCallableType or PVariantType thereof, got %{type_class}") % { type_class: type.class }
      end
      unless name.is_a?(Symbol)
        raise ArgumentError, _("Expected block_param name to be a Symbol, got %{name_class}") % { name_class: name.class }
      end
      if @block_type.nil?
        @block_type = type
        @block_name = name
      else
        raise ArgumentError, _('Attempt to redefine block')
      end
    end
def block_param ( * type_and_name ) case type_and_name . size when 0 type = @all_callables name = :block when 1 type = @all_callables name = type_and_name [ 0 ] when 2 type_string , name = type_and_name type = Puppet :: Pops :: Types :: TypeParser . singleton . parse ( type_string , loader ) else raise ArgumentError , _ ( "block_param accepts max 2 arguments (type, name), got %{size}." ) % { size : type_and_name . size } end unless Puppet :: Pops :: Types :: TypeCalculator . is_kind_of_callable? ( type , false ) raise ArgumentError , _ ( "Expected PCallableType or PVariantType thereof, got %{type_class}" ) % { type_class : type . class } end unless name . is_a? ( Symbol ) raise ArgumentError , _ ( "Expected block_param name to be a Symbol, got %{name_class}" ) % { name_class : name . class } end if @block_type . nil? @block_type = type @block_name = name else raise ArgumentError , _ ( 'Attempt to redefine block' ) end end
Defines one required block parameter that may appear last.
Defines one required block parameter that may appear last .
type_and_name
api
None