Skip to content

Commit c54643e

Browse files
committed
Prefer tr over gsub to translate single letters
1 parent 65f1341 commit c54643e

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
@@ -800,13 +800,13 @@ def excerpt(comment)
800800
# Match from a capital letter to the first period, discarding any links, so
801801
# that we don't end up matching badges in the README
802802
first_paragraph_match = text.match(ParagraphExcerptRegexp)
803-
return text[0...150].gsub(/\n/, " ").squeeze(" ") unless first_paragraph_match
803+
return text[0...150].tr_s("\n", " ").squeeze(" ") unless first_paragraph_match
804804

805805
extracted_text = first_paragraph_match[0]
806806
second_paragraph = first_paragraph_match.post_match.match(ParagraphExcerptRegexp)
807807
extracted_text << " " << second_paragraph[0] if second_paragraph
808808

809-
extracted_text[0...150].gsub(/\n/, " ").squeeze(" ")
809+
extracted_text[0...150].tr_s("\n", " ").squeeze(" ")
810810
end
811811

812812
def generate_ancestor_list(ancestors, klass)

0 commit comments

Comments
 (0)