Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/rake/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,11 @@ def transform_comments(separator, &block)
private :transform_comments

# Get the first sentence in a string. The sentence is terminated
# by the first period, exclamation mark, or the end of the line.
# Decimal points do not count as periods.
# by the first period, exclamation mark, question mark, or the end
# of the line. Multiple spaces after sentence terminators are
# ignored to avoid splitting on abbreviations like "e.g.".
def first_sentence(string)
string.split(/(?<=\w)(\.|!)[ \t]|(\.$|!)|\n/).first
string.split(/(?<=[.!?])\s+/).first
end
private :first_sentence

Expand Down