External: remove &block arg, use block_given?

Addresses my comment in https://github.com/jekyll/jekyll/pull/4936#discussion_r64598949
This commit is contained in:
Parker Moore 2016-05-25 08:55:12 -07:00
parent 1c937013fd
commit 733c56a65e
No known key found for this signature in database
GPG Key ID: 193CDEBA72063C58
1 changed files with 2 additions and 2 deletions

View File

@ -17,13 +17,13 @@ module Jekyll
# #
# names - a string gem name or array of gem names # names - a string gem name or array of gem names
# #
def require_if_present(names, &block) def require_if_present(names)
Array(names).each do |name| Array(names).each do |name|
begin begin
require name require name
rescue LoadError rescue LoadError
Jekyll.logger.debug "Couldn't load #{name}. Skipping." Jekyll.logger.debug "Couldn't load #{name}. Skipping."
yield(name) if block yield(name) if block_given?
false false
end end
end end