|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | | -# @summary |
4 | | -# Returns the type of the passed value. |
5 | | -# |
6 | | -# @example how to compare values' types |
7 | | -# # compare the types of two values |
8 | | -# if type_of($first_value) != type_of($second_value) { fail("first_value and second_value are different types") } |
9 | | -# @example how to compare against an abstract type |
10 | | -# unless type_of($first_value) <= Numeric { fail("first_value must be Numeric") } |
11 | | -# unless type_of{$first_value) <= Collection[1] { fail("first_value must be an Array or Hash, and contain at least one element") } |
12 | | -# |
13 | | -# See the documentation for "The Puppet Type System" for more information about types. |
14 | | -# See the `assert_type()` function for flexible ways to assert the type of a value. |
15 | | -# |
16 | | -# The built-in type() function in puppet is generally preferred over this function |
17 | | -# this function is provided for backwards compatibility. |
| 3 | +# THIS FILE WAS GENERATED BY `rake regenerate_unamespaced_shims` |
| 4 | + |
| 5 | +# @summary DEPRECATED. Use the namespaced function [`stdlib::type_of`](#stdlibtype_of) instead. |
18 | 6 | Puppet::Functions.create_function(:type_of) do |
19 | | - # @return [String] |
20 | | - # the type of the passed value |
21 | | - # |
22 | | - # @param value |
23 | | - def type_of(value) |
24 | | - Puppet::Pops::Types::TypeCalculator.infer_set(value) |
| 7 | + dispatch :deprecation_gen do |
| 8 | + repeated_param 'Any', :args |
| 9 | + end |
| 10 | + def deprecation_gen(*args) |
| 11 | + call_function('deprecation', 'type_of', 'This function is deprecated, please use stdlib::type_of instead.') |
| 12 | + call_function('stdlib::type_of', *args) |
25 | 13 | end |
26 | 14 | end |
0 commit comments