diff options
author | ojab <ojab@ojab.ru> | 2015-04-12 20:37:46 +0000 |
---|---|---|
committer | ojab <ojab@ojab.ru> | 2015-04-12 21:45:50 +0000 |
commit | 1a0853c41f0d7a7ac5708fdc5f14f2aeba4bcbe0 (patch) | |
tree | 014d1beaea5c0ff1ab865ade44c3f54da940206b /activesupport | |
parent | 4825042a1c8d5527a7da468937d03f7e07362ce1 (diff) | |
download | rails-1a0853c41f0d7a7ac5708fdc5f14f2aeba4bcbe0.tar.gz rails-1a0853c41f0d7a7ac5708fdc5f14f2aeba4bcbe0.tar.bz2 rails-1a0853c41f0d7a7ac5708fdc5f14f2aeba4bcbe0.zip |
Speedup String#squish
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/filters.rb | 3 |
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 |