Fix issues spotted by @fredZen in #1802

This commit is contained in:
gregoirenovel 2018-04-06 16:21:48 +02:00
parent f2f7fae6c9
commit c60c58ff8b
2 changed files with 5 additions and 2 deletions

View file

@ -50,6 +50,9 @@ class AttestationTemplate < ApplicationRecord
def used_tags
delimiters_regex = /--(?<capture>((?!--).)*)--/
# We can't use flat_map as scan will return 3 levels of array,
# using flat_map would give us 2, whereas flatten will
# give us 1, which is what we want
[title, body]
.map { |str| str.scan(delimiters_regex) }
.flatten