extend/os/linux/formula.rb: allowed_missing_lib: check input class

This commit is contained in:
Maxim Belkin 2020-07-21 15:40:27 +00:00
parent 28227bd26b
commit 68ebf8866a

View File

@ -9,6 +9,8 @@ class Formula
undef allowed_missing_lib? undef allowed_missing_lib?
def allowed_missing_lib?(lib) def allowed_missing_lib?(lib)
raise TypeError "Library must be a string; got a #{lib.class} (#{lib})" unless lib.is_a? String
# lib: Full path to the missing library # lib: Full path to the missing library
# Ex.: /home/linuxbrew/.linuxbrew/lib/libsomething.so.1 # Ex.: /home/linuxbrew/.linuxbrew/lib/libsomething.so.1
# x - Name of or a pattern for a library, linkage to which is allowed to be missing. # x - Name of or a pattern for a library, linkage to which is allowed to be missing.
@ -19,7 +21,7 @@ class Formula
when Regexp when Regexp
x.match? lib x.match? lib
when String when String
lib.to_s.include? x lib.include? x
end end
end end
end end