diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2019-07-26 13:44:13 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-07-26 13:44:13 +0300 |
commit | 8136fac26c8f470720ff90d152b93abf50f5084d (patch) | |
tree | 3f50aab69d5c5841d9b5aa1c9a64804eea29d877 /lib/banzai/reference_redactor.rb | |
parent | 0d2b5bff8c524376f42316f1a4cc8cfbeabc2d8d (diff) |
Prefer `flat_map` over `map` + `flatten`
Convert several occurrences of `map` + `flatten` to
`flat_map` where applicable.
Diffstat (limited to 'lib/banzai/reference_redactor.rb')
-rw-r--r-- | lib/banzai/reference_redactor.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/banzai/reference_redactor.rb b/lib/banzai/reference_redactor.rb index eb5c35da375..936436982e7 100644 --- a/lib/banzai/reference_redactor.rb +++ b/lib/banzai/reference_redactor.rb @@ -33,7 +33,7 @@ module Banzai # # data - An Array of a Hashes mapping an HTML document to nodes to redact. def redact_document_nodes(all_document_nodes) - all_nodes = all_document_nodes.map { |x| x[:nodes] }.flatten + all_nodes = all_document_nodes.flat_map { |x| x[:nodes] } visible = nodes_visible_to_user(all_nodes) metadata = [] |