From 305342782998e36e48e1011d12a37c523b838bec Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Fri, 5 Dec 2014 08:48:10 +0100 Subject: Fixing ruby 1.8 support. --- lib/puppet/parser/functions/validate_integer.rb | 3 +++ lib/puppet/parser/functions/validate_numeric.rb | 3 +++ 2 files changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/puppet/parser/functions/validate_integer.rb b/lib/puppet/parser/functions/validate_integer.rb index c12d676..995f8db 100644 --- a/lib/puppet/parser/functions/validate_integer.rb +++ b/lib/puppet/parser/functions/validate_integer.rb @@ -115,6 +115,9 @@ module Puppet::Parser::Functions raise Puppet::ParseError, "validate_integer(): Expected element at array position #{pos} to be an Integer, got #{arg.class}" end end + # for the sake of compatibility with ruby 1.8, we need extra handling of hashes + when Hash + raise Puppet::ParseError, "validate_integer(): Expected first argument to be an Integer or Array, got #{input.class}" # check the input. this will also fail any stuff other than pure, shiny integers else begin diff --git a/lib/puppet/parser/functions/validate_numeric.rb b/lib/puppet/parser/functions/validate_numeric.rb index 27eec30..d2e4d16 100644 --- a/lib/puppet/parser/functions/validate_numeric.rb +++ b/lib/puppet/parser/functions/validate_numeric.rb @@ -77,6 +77,9 @@ module Puppet::Parser::Functions raise Puppet::ParseError, "validate_numeric(): Expected element at array position #{pos} to be a Numeric, got #{arg.class}" end end + # for the sake of compatibility with ruby 1.8, we need extra handling of hashes + when Hash + raise Puppet::ParseError, "validate_integer(): Expected first argument to be a Numeric or Array, got #{input.class}" # check the input. this will also fail any stuff other than pure, shiny integers else begin -- cgit v1.2.3