aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-03-13 02:25:10 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-03-13 02:25:10 +0000
commit9d4fa7c4a70fd3a9e07cb5fbfa58fe391da3ddfc (patch)
tree5a436a4f37f242a946aa3bc8b43fb4d2c3e138fa /activesupport/lib
parentbcb47a843bc3e8430cadea7f98b41e9963ace2de (diff)
downloadrails-9d4fa7c4a70fd3a9e07cb5fbfa58fe391da3ddfc.tar.gz
rails-9d4fa7c4a70fd3a9e07cb5fbfa58fe391da3ddfc.tar.bz2
rails-9d4fa7c4a70fd3a9e07cb5fbfa58fe391da3ddfc.zip
Applied the faster squish version (closes #11123) [jordi]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9015 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/string/filters.rb6
1 files changed, 4 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 3a69131ea0..0329fbb8d4 100644
--- a/activesupport/lib/active_support/core_ext/string/filters.rb
+++ b/activesupport/lib/active_support/core_ext/string/filters.rb
@@ -11,12 +11,14 @@ module ActiveSupport #:nodoc:
# string }.squish # => "Multi-line string"
# " foo bar \n \t boo".squish # => "foo bar boo"
def squish
- strip.gsub(/\s+/, ' ')
+ dup.squish!
end
# Performs a destructive squish. See String#squish.
def squish!
- replace(squish)
+ strip!
+ gsub!(/\s+/, ' ')
+ self
end
end
end