Small refactor using Object#in?

This commit is contained in:
Sijawusz Pur Rahnama 2022-11-26 02:32:11 +01:00
parent 748cab29b4
commit 5502f0f8d1

View file

@ -33,6 +33,7 @@ module Ameba
@code = corrected_code @code = corrected_code
@lines = nil @lines = nil
@ast = nil @ast = nil
true true
end end
@ -70,9 +71,9 @@ module Ameba
path.ends_with?("_spec.cr") path.ends_with?("_spec.cr")
end end
# Returns `true` if *filepath* matches the source's path, `false` if it does not. # Returns `true` if *filepath* matches the source's path, `false` otherwise.
def matches_path?(filepath) def matches_path?(filepath)
path == filepath || path == File.expand_path(filepath) path.in?(filepath, File.expand_path(filepath))
end end
end end
end end