mirror of https://github.com/rails/rails
Speedup String#squish
This commit is contained in:
parent
4825042a1c
commit
1a0853c41f
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue