Permalink
Browse files

Applied the faster squish version (closes #11123) [jordi]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9015 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent bcb47a8 commit 9d4fa7c4a70fd3a9e07cb5fbfa58fe391da3ddfc @dhh dhh committed Mar 13, 2008
Showing with 5 additions and 3 deletions.
  1. +4 −2 activesupport/lib/active_support/core_ext/string/filters.rb
  2. +1 −1 railties/lib/initializer.rb
@@ -11,12 +11,14 @@ module Filters
# 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
@@ -255,7 +255,7 @@ def initialize_logger
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(

0 comments on commit 9d4fa7c

Please sign in to comment.