diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-05-20 01:50:22 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2021-05-20 01:50:22 -0600 |
| commit | 9065ca75e75d7dabc89b1261ba1968c3c79d452b (patch) | |
| tree | 60a25bccc237b32b94c024986fa8260c37c5e38b /lib | |
| parent | ed36e1338242e9a51fc4e4b3535ea6275447f0ce (diff) | |
use next to short circuit loop with single conditional
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/asciidoctor/parser.rb | 13 |
1 files changed, 6 insertions, 7 deletions
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 |
