Ticket #11123: fast_banged_squish.diff
| File fast_banged_squish.diff, 0.6 kB (added by jordi, 7 months ago) |
|---|
-
activesupport/lib/active_support/core_ext/string/filters.rb
old new 11 11 # string }.squish # => "Multi-line string" 12 12 # " foo bar \n \t boo".squish # => "foo bar boo" 13 13 def squish 14 strip.gsub(/\s+/, ' ')14 dup.squish! 15 15 end 16 16 17 17 # Performs a destructive squish. See String#squish. 18 18 def squish! 19 replace(squish) 19 strip! 20 gsub!(/\s+/, ' ') 21 self 20 22 end 21 23 end 22 24 end