Speedup String#squish

This commit is contained in:
ojab 2015-04-12 20:37:46 +00:00
parent 4825042a1c
commit 1a0853c41f
1 changed files with 1 additions and 2 deletions

View File

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