# validate_slength.rb
#
module Puppet::Parser::Functions
- newfunction(:validate_slength, :doc => <<-'DOC') do |args|
- Validate that the first argument is a string (or an array of strings), and
- less/equal to than the length of the second argument. An optional third
- parameter can be given the minimum length. It fails if the first
- argument is not a string or array of strings, and if arg 2 and arg 3 are
- not convertable to a number.
+ newfunction(:validate_slength, :doc => <<-DOC
+ @summary
+ Validate that the first argument is a string (or an array of strings), and less/equal to than the length of the second argument.
+ An optional third parameter can be given the minimum length. It fails if the first argument is not a string or array of strings,
+ and if arg 2 and arg 3 are not convertable to a number.
- The following values will pass:
+ @return
+ validate that the first argument is a string (or an array of strings), and less/equal to than the length of the second argument. Fail compilation if any of the checks fail.
- validate_slength("discombobulate",17)
- validate_slength(["discombobulate","moo"],17)
- validate_slength(["discombobulate","moo"],17,3)
+ @example **Usage**
+ The following values will pass:
- The following valueis will not:
+ validate_slength("discombobulate",17)
+ validate_slength(["discombobulate","moo"],17)
+ validate_slength(["discombobulate","moo"],17,3)
- validate_slength("discombobulate",1)
- validate_slength(["discombobulate","thermometer"],5)
- validate_slength(["discombobulate","moo"],17,10)
+ The following valueis will not:
+ validate_slength("discombobulate",1)
+ validate_slength(["discombobulate","thermometer"],5)
+ validate_slength(["discombobulate","moo"],17,10)
DOC
-
+ ) do |args|
function_deprecation([:validate_slength, 'This method is deprecated, please use the stdlib validate_legacy function,
with String[]. There is further documentation for validate_legacy function in the README.'])