Merge pull request #19738 from ojab/squish

Speedup String#squish
This commit is contained in:
Xavier Noria 2015-04-12 15:10:51 -07:00
commit f39ec6676a

@ -17,9 +17,8 @@ def squish
# str.squish! # => "foo bar boo"
# str # => "foo bar boo"
def squish!
gsub!(/\A[[:space:]]+/, '')
gsub!(/[[:space:]]+\z/, '')
gsub!(/[[:space:]]+/, ' ')
strip!
self
end