Puppet Function: stringsum

Defined in:
lib/puppet/parser/functions/stringsum.rb
Function type:
Ruby 3.x API

Overview

stringsum()Any

Returns the ruby String#sum value for the given string

For example:

$test = stringsum("somevalue")

Returns:

  • (Any)


5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/puppet/parser/functions/stringsum.rb', line 5

newfunction(:stringsum, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
  Returns the ruby String#sum value for the given string

  For example:

      $test = stringsum("somevalue")
  ENDHEREDOC

  unless args.length == 1
    raise Puppet::ParseError, ("hash2props(): wrong number of arguments (#{args.length}; must be 1)")
  end

  args[0].to_s.sum
end