diff options
author | Ken Barber <ken@bob.sh> | 2011-07-28 15:38:19 +0100 |
---|---|---|
committer | Ken Barber <ken@bob.sh> | 2011-07-28 15:38:19 +0100 |
commit | a55930368afe2e8177608472653c4696eccec92f (patch) | |
tree | f8c01004920fd982c7b0e50fba472b18171ad068 /lib/puppet/parser | |
parent | fde64f37c98291f4a5b9ee1fcf634288e42b730a (diff) |
(#2) - Added is_float and is_integer functionality.
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/functions/is_float.rb | 8 | ||||
-rw-r--r-- | lib/puppet/parser/functions/is_integer.rb | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/is_float.rb b/lib/puppet/parser/functions/is_float.rb index 39d097f..8aed848 100644 --- a/lib/puppet/parser/functions/is_float.rb +++ b/lib/puppet/parser/functions/is_float.rb @@ -12,6 +12,14 @@ module Puppet::Parser::Functions "given #{arguments.size} for 1") end + value = arguments[0] + + if value != value.to_f.to_s then + return false + else + return true + end + end end diff --git a/lib/puppet/parser/functions/is_integer.rb b/lib/puppet/parser/functions/is_integer.rb index 9813cf1..9dd1cee 100644 --- a/lib/puppet/parser/functions/is_integer.rb +++ b/lib/puppet/parser/functions/is_integer.rb @@ -12,6 +12,14 @@ module Puppet::Parser::Functions "given #{arguments.size} for 1") end + value = arguments[0] + + if value != value.to_i.to_s then + return false + else + return true + end + end end |