aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2015-04-12 15:10:51 -0700
committerXavier Noria <fxn@hashref.com>2015-04-12 15:10:51 -0700
commitf39ec6676a281605ee41b26a6d9a94b80ad92543 (patch)
tree095c0e939056576d823a78633968398058b36bec /activesupport/lib
parent41541b58cb05d278a20487f447af3798480ab210 (diff)
parent1a0853c41f0d7a7ac5708fdc5f14f2aeba4bcbe0 (diff)
downloadrails-f39ec6676a281605ee41b26a6d9a94b80ad92543.tar.gz
rails-f39ec6676a281605ee41b26a6d9a94b80ad92543.tar.bz2
rails-f39ec6676a281605ee41b26a6d9a94b80ad92543.zip
Merge pull request #19738 from ojab/squish
Speedup String#squish
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/string/filters.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/filters.rb b/activesupport/lib/active_support/core_ext/string/filters.rb
index 7461d03acc..375ec1aef8 100644
--- a/activesupport/lib/active_support/core_ext/string/filters.rb
+++ b/activesupport/lib/active_support/core_ext/string/filters.rb
@@ -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