aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/string
diff options
context:
space:
mode:
authorojab <ojab@ojab.ru>2015-04-12 20:37:46 +0000
committerojab <ojab@ojab.ru>2015-04-12 21:45:50 +0000
commit1a0853c41f0d7a7ac5708fdc5f14f2aeba4bcbe0 (patch)
tree014d1beaea5c0ff1ab865ade44c3f54da940206b /activesupport/lib/active_support/core_ext/string
parent4825042a1c8d5527a7da468937d03f7e07362ce1 (diff)
downloadrails-1a0853c41f0d7a7ac5708fdc5f14f2aeba4bcbe0.tar.gz
rails-1a0853c41f0d7a7ac5708fdc5f14f2aeba4bcbe0.tar.bz2
rails-1a0853c41f0d7a7ac5708fdc5f14f2aeba4bcbe0.zip
Speedup String#squish
Diffstat (limited to 'activesupport/lib/active_support/core_ext/string')
-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