Skip to content

Commit

Permalink
Fix build for Ruby 2.3 and 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
spk committed Jul 3, 2020
1 parent 4c5bcc1 commit 7eff359
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/validate_website/crawl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ def on_every_html_page(crawler)
end

if validate?(page)
validate(page.doc, page.body, page.url,
options.slice(:ignore, :html5_validator))
keys = %i[ignore html5_validator]
# slice does not exists on Ruby <= 2.4
slice = Hash[[keys, options.values_at(*keys)].transpose]
validate(page.doc, page.body, page.url, slice)
end
end
end
Expand Down
6 changes: 4 additions & 2 deletions lib/validate_website/static.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ def check_static_file(file)

def check_page(file, page)
if page.html? && options[:markup]
validate(page.doc, page.body, file,
options.slice(:ignore, :html5_validator))
keys = %i[ignore html5_validator]
# slice does not exists on Ruby <= 2.4
slice = Hash[[keys, options.values_at(*keys)].transpose]
validate(page.doc, page.body, file, slice)
end
check_static_not_found(page.links) if options[:not_found]
end
Expand Down

0 comments on commit 7eff359

Please sign in to comment.