Skip to content

Commit f09237e

Browse files
committed
impr: more strict check, also improve performance
1 parent 7cc5468 commit f09237e

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/rootfs/distro/ubuntu/arch.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ def parse_arch(any)
2222
str = any.to_s
2323
puts err_msg if str.empty?
2424

25-
ARCH.each do |arch|
26-
return { arch: arch } if str.include?(arch)
27-
end
25+
return { arch: str } if ARCH.include?(str)
26+
2827
puts err_msg
2928
end
3029
end

lib/rootfs/distro/ubuntu/edition.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ def parse_edition(any)
4949
str = any.to_s
5050
puts err_msg if str.empty?
5151

52-
EDITION.each do |edition|
53-
return { edition: edition } if str.include?(edition)
54-
end
52+
return { edition: str } if EDITION.include?(str)
53+
5554
puts err_msg
5655
end
5756

0 commit comments

Comments
 (0)