Puppet Function: validate_integer
- Defined in:
- lib/puppet/parser/functions/validate_integer.rb
- Function type:
- Ruby 3.x API
Overview
Validates that the passed argument is an Integer
.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/puppet/parser/functions/validate_integer.rb', line 2 newfunction(:validate_integer, :doc => <<-EOS) do |args| if (args.size != 1) Validates that the passed argument is an `Integer`. @return [Nil] EOS raise(Puppet::ParseError, "is_integer(): Wrong number of args given #{args.size} for 1") end value = "#{args[0]}" if value != value.to_i.to_s raise Puppet::ParseError, ("'#{args}' is not an integer.") end end |