Sha256: c2a151e70a7d91bbd3a87f384a153cfd7d743717c28bbcdab674ecfff3f7429d
Contents?: true
Size: 506 Bytes
Versions: 5
Compression:
Stored size: 506 Bytes
Contents
class String # 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
Version data entries
5 entries across 5 versions & 2 rubygems