greg.poirier@opower.com
2013-Feb-07 17:43 UTC
[Puppet Users] stdlib::member "support for strings and hashes" todo
I am curious as to how support for strings would work. To me, it seems there are two possibile use-cases for support for strings. Take the following example: Assume: - extdata exists, identified by ''array'' - extlookup(''array'') may return an array or a single string (in the case that the "array" only has one member) Case 1: $array = extlookup("array") -> extlookup returns a string member($array, ''some_string'') -> returns true if $array is the string ''some_string'' Case 2: $array = extlookup("array") -> extlookup returns an array member returns true if array.includes?(''some_string'') The alternative, I suppose, would be substring matching, but in that case wouldn''t "member" be a misnomer and shouldn''t the more common substr() be added? For hash membership, we would want to look for key membership, yes? Anyway, came across an instance of when this kind of behavior would be useful, and was wondering if this behavior was the intent behind this particular TODO. If so, I will submit a patch. Thanks, Greg -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.