HEX
Server: Apache
System: Linux dinesh8189 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: cgmgerenciamento1 (814285)
PHP: 8.1.26
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/functions/scanf.rb
# Scans a string and returns an array of one or more converted values based on the given format string.
# See the documentation of Ruby's String#scanf method for details about the supported formats (which
# are similar but not identical to the formats used in Puppet's `sprintf` function.)
#
# This function takes two mandatory arguments: the first is the string to convert, and the second is
# the format string. The result of the scan is an array, with each successfully scanned and transformed value.
# The scanning stops if a scan is unsuccessful, and the scanned result up to that point is returned. If there
# was no successful scan, the result is an empty array.
#
#    "42".scanf("%i")
#
# You can also optionally pass a lambda to scanf, to do additional validation or processing.
#
#
#     "42".scanf("%i") |$x| {
#       unless $x[0] =~ Integer {
#         fail "Expected a well formed integer value, got '$x[0]'"
#       }
#       $x[0]
#     }
#
#
#
#
#
# @since 4.0.0
#
Puppet::Functions.create_function(:scanf) do
  require 'scanf'

  dispatch :scanf do
    param 'String', :data
    param 'String', :format
    optional_block_param
  end

  def scanf(data, format)
    result = data.scanf(format)
    if block_given?
      result = yield(result)
    end
    result
  end
end