Target Ruby 2.4 syntax in RuboCop scans (#7583)

Merge pull request 7583
This commit is contained in:
Ashwin Maroli 2019-04-19 20:00:17 +05:30 committed by jekyllbot
parent f4ee82650e
commit c8fe609f8f
4 changed files with 7 additions and 7 deletions

View File

@ -8,7 +8,7 @@ Jekyll/NoPutsAllowed:
- rake/*.rake
AllCops:
TargetRubyVersion: 2.3
TargetRubyVersion: 2.4
Include:
- lib/**/*.rb
- test/**/*.rb

View File

@ -29,15 +29,15 @@ module Jekyll
end
def inline?
@response["Content-Disposition"] =~ %r!^inline!
@response["Content-Disposition"].to_s.start_with?("inline")
end
def bad_browser?
BAD_USER_AGENTS.any? { |pattern| @request["User-Agent"] =~ pattern }
BAD_USER_AGENTS.any? { |pattern| pattern.match?(@request["User-Agent"]) }
end
def html?
@response["Content-Type"] =~ %r!text/html!
@response["Content-Type"].to_s.include?("text/html")
end
end
@ -185,7 +185,7 @@ module Jekyll
key = res.header.keys.grep(%r!content-type!i).first
typ = res.header[key]
unless typ =~ %r!;\s*charset=!
unless %r!;\s*charset=!.match?(typ)
res.header[key] = "#{typ}; charset=#{@jekyll_opts["encoding"]}"
end
end

View File

@ -46,7 +46,7 @@ module Jekyll
# WebSockets requests will have a Connection: Upgrade header
if parser.http_method != "GET" || parser.upgrade?
super
elsif parser.request_url =~ %r!^\/livereload.js!
elsif parser.request_url.start_with?("/livereload.js")
headers = [
"HTTP/1.1 200 OK",
"Content-Type: application/javascript",

View File

@ -69,7 +69,7 @@ module Jekyll
end
def validate_params
unless @params =~ FULL_VALID_SYNTAX
unless FULL_VALID_SYNTAX.match?(@params)
raise ArgumentError, <<~MSG
Invalid syntax for include tag: