Puppet Function: st2::urlencode

Defined in:
lib/puppet/functions/st2/urlencode.rb
Function type:
Ruby 4.x API

Overview

st2::urlencode(String $url)String

URL encodes a string

Examples:

Basic usage

st2::urlencode('xyz!123')

Parameters:

  • url (String)

    Raw URL data to encode

Returns:

  • (String)

    URL encoded data



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/puppet/functions/st2/urlencode.rb', line 4

Puppet::Functions.create_function(:'st2::urlencode') do
  # @param url Raw URL data to encode
  # @return [String] URL encoded data
  # @example Basic usage
  #   st2::urlencode('xyz!123')
  dispatch :urlencode do
    param 'String', :url
  end

  def urlencode(url)
    CGI.escape(url)
  end
end