diff options
author | Morgan Haskel <morgan@puppetlabs.com> | 2015-07-09 10:20:37 -0700 |
---|---|---|
committer | Morgan Haskel <morgan@puppetlabs.com> | 2015-07-09 10:20:37 -0700 |
commit | 07c38e518a19892bd6c77314d65e2209ebddc48d (patch) | |
tree | ca3bdbdfee6c8f3625c8a35250b5cb69921fb873 /lib/puppet/parser | |
parent | b2aed66226b4fe33fe24252eab7a6e64a4a03ddd (diff) | |
parent | c64ecfb0c39b633675269ab02f323f7eb486dad4 (diff) |
Merge pull request #482 from DavidS/document_validate_slength_3rd_arg
Add validate_slength's optional 3rd arg to README
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/functions/validate_slength.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/puppet/parser/functions/validate_slength.rb b/lib/puppet/parser/functions/validate_slength.rb index 7d534f3..47c7d4a 100644 --- a/lib/puppet/parser/functions/validate_slength.rb +++ b/lib/puppet/parser/functions/validate_slength.rb @@ -3,7 +3,7 @@ module Puppet::Parser::Functions newfunction(:validate_slength, :doc => <<-'ENDHEREDOC') 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 a the minimum length. It fails if the first + 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. @@ -43,9 +43,7 @@ module Puppet::Parser::Functions min_length = 0 end - if min_length > max_length - raise Puppet::ParseError, "validate_slength(): Expected second argument to be larger than third argument" - end + raise Puppet::ParseError, "validate_slength(): Expected second argument to be equal to or larger than third argument" unless max_length >= min_length validator = lambda do |str| unless str.length <= max_length and str.length >= min_length |