Skip to content

Commit 0293887

Browse files
committed
Prefer tr over gsub to translate single letters
1 parent d3e62fd commit 0293887

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rdoc/generator/darkfish.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,13 +714,13 @@ def excerpt(comment)
714714
# Match from a capital letter to the first period, discarding any links, so
715715
# that we don't end up matching badges in the README
716716
first_paragraph_match = text.match(ParagraphExcerptRegexp)
717-
return text[0...150].gsub(/\n/, " ").squeeze(" ") unless first_paragraph_match
717+
return text[0...150].tr_s("\n", " ").squeeze(" ") unless first_paragraph_match
718718

719719
extracted_text = first_paragraph_match[0]
720720
second_paragraph = first_paragraph_match.post_match.match(ParagraphExcerptRegexp)
721721
extracted_text << " " << second_paragraph[0] if second_paragraph
722722

723-
extracted_text[0...150].gsub(/\n/, " ").squeeze(" ")
723+
extracted_text[0...150].tr_s("\n", " ").squeeze(" ")
724724
end
725725

726726
def generate_ancestor_list(ancestors, klass)

0 commit comments

Comments
 (0)