Skip to content

Commit e9a31e0

Browse files
committed
eadd length tests
1 parent a45bf80 commit e9a31e0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/puppet/functions/length.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
scope_param
55
optional_repeated_param 'Any', :args
66
end
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
715

816
def deprecation_gen(scope, *args)
917
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

0 commit comments

Comments
 (0)