Replace String#=~ with String#match? (#7723)

Merge pull request 7723
This commit is contained in:
Ashwin Maroli
2019-06-27 22:46:27 +05:30
committed by jekyllbot
parent 62959527dd
commit 4530721575

View File

@@ -135,7 +135,7 @@ module Jekyll
# Returns true if the YAML front matter is present.
# rubocop: disable PredicateName
def has_yaml_header?(file)
!!(File.open(file, "rb", &:readline) =~ %r!\A---\s*\r?\n!)
File.open(file, "rb", &:readline).match? %r!\A---\s*\r?\n!
rescue EOFError
false
end