From 9d4fa7c4a70fd3a9e07cb5fbfa58fe391da3ddfc Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 13 Mar 2008 02:25:10 +0000 Subject: [PATCH] Applied the faster squish version (closes #11123) [jordi] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9015 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/core_ext/string/filters.rb | 6 ++++-- railties/lib/initializer.rb | 2 +- 2 files changed, 5 insertions(+), 3 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 diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index d839415e49..01acc50763 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -255,7 +255,7 @@ module Rails logger.auto_flushing = false logger.set_non_blocking_io end - rescue StandardError =>e + rescue StandardError => e logger = ActiveSupport::BufferedLogger.new(STDERR) logger.level = ActiveSupport::BufferedLogger::WARN logger.warn(