2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/cfn-model/model/principal.rb', line 2
def self.wildcard?(principal)
if principal.is_a? String
return has_asterisk principal
elsif principal.is_a? Hash
has_wildcard = false
principal.values.each do |principal_value|
if principal_value.is_a? String
has_wildcard ||= has_asterisk principal_value
elsif principal_value.is_a? Array
wildcard_principal = principal_value.find { |principal_iter| principal_iter =~ /\*/ }
has_wildcard ||= !wildcard_principal.nil?
end
end
has_wildcard
elsif principal.nil?
false
else
raise "whacky principal not string or hash: #{principal}"
end
end
|