Skip to content

Commit 7823ec5

Browse files
committed
readd length tests
1 parent a45bf80 commit 7823ec5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/puppet/functions/length.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
scope_param
55
optional_repeated_param 'Any', :args
66
end
7-
7+
def length(value)
8+
if value.is_a?(String)
9+
result = value.length
10+
elsif value.is_a?(Array) || value.is_a?(Hash)
11+
result = value.size
12+
end
13+
result
14+
end
815
def deprecation_gen(scope, *args)
916
call_function('deprecation', 'length', 'This method is deprecated, this function is now shipped with Puppet in versions 5.5.0 and later. For more information please see Puppet 5.5.0 Release Notes.') # rubocop:disable Metrics/LineLength
1017
scope.send('function_length', args)

0 commit comments

Comments
 (0)