Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / core_ext / string / filters.rb
1 module ActiveSupport #:nodoc:
2 module CoreExtensions #:nodoc:
3 module String #:nodoc:
4 module Filters
5 # Returns the string, first removing all whitespace on both ends of
6 # the string, and then changing remaining consecutive whitespace
7 # groups into one space each.
8 #
9 # Examples:
10 # %{ Multi-line
11 # string }.squish # => "Multi-line string"
12 # " foo bar \n \t boo".squish # => "foo bar boo"
13 def squish
14 dup.squish!
15 end
16
17 # Performs a destructive squish. See String#squish.
18 def squish!
19 strip!
20 gsub!(/\s+/, ' ')
21 self
22 end
23 end
24 end
25 end
26 end