/usr/lib/ruby/vendor_ruby/active_support/core_ext/string/filters.rb is in ruby-activesupport-2.3 2.3.14-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module String #:nodoc:
module Filters
# Returns the string, first removing all whitespace on both ends of
# the string, and then changing remaining consecutive whitespace
# groups into one space each.
#
# Examples:
# %{ Multi-line
# string }.squish # => "Multi-line string"
# " foo bar \n \t boo".squish # => "foo bar boo"
def squish
dup.squish!
end
# Performs a destructive squish. See String#squish.
def squish!
strip!
gsub!(/\s+/, ' ')
self
end
end
end
end
end
|