From 9065ca75e75d7dabc89b1261ba1968c3c79d452b Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 20 May 2021 01:50:22 -0600 Subject: use next to short circuit loop with single conditional --- lib/asciidoctor/parser.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/asciidoctor/parser.rb b/lib/asciidoctor/parser.rb index 1ac090c9..c23fe9ea 100644 --- a/lib/asciidoctor/parser.rb +++ b/lib/asciidoctor/parser.rb @@ -1867,13 +1867,12 @@ class Parser if explicit # rebuild implicit author names to reparse authors.each_with_index do |author, idx| - unless author - authors[idx] = [ - author_metadata[%(firstname_#{name_idx = idx + 1})], - author_metadata[%(middlename_#{name_idx})], - author_metadata[%(lastname_#{name_idx})] - ].compact.map {|it| it.tr ' ', '_' }.join ' ' - end + next if author + authors[idx] = [ + author_metadata[%(firstname_#{name_idx = idx + 1})], + author_metadata[%(middlename_#{name_idx})], + author_metadata[%(lastname_#{name_idx})] + ].compact.map {|it| it.tr ' ', '_' }.join ' ' end if sparse # process as names only author_metadata = process_authors authors, true, false -- cgit v1.2.3