File tree Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,36 @@ module Parse
7
7
def _str_in_arr ( any , distro , attr , data )
8
8
err_msg = "Valid #{ distro } #{ attr } : #{ data } "
9
9
10
- puts err_msg unless any
10
+ return { " #{ attr } " : any } if data . include? ( any )
11
11
12
- str = any . to_s
13
- puts err_msg if str . empty?
12
+ puts err_msg
13
+ end
14
14
15
- return { "#{ attr } " : str } if data . include? ( str )
15
+ def _arr_in_arr ( any , distro , attr , data )
16
+ err_msg = "Valid #{ distro } #{ attr } : #{ data } "
16
17
17
- puts err_msg
18
+ args = any . instance_of? ( Array ) ? any : [ any ]
19
+ if args . empty?
20
+ puts err_msg
21
+ return
22
+ end
23
+
24
+ res = [ ]
25
+ not_valid = [ ]
26
+ args . each do |arg |
27
+ if data . include? ( arg )
28
+ res . push ( arg )
29
+ else
30
+ not_valid . push ( arg )
31
+ end
32
+ end
33
+
34
+ unless not_valid . empty?
35
+ puts "Not valid: #{ not_valid } "
36
+ puts err_msg
37
+ end
38
+
39
+ { "#{ attr } " : res } unless res . empty?
18
40
end
19
41
end
20
42
end
You can’t perform that action at this time.
0 commit comments