module Scrubba

Constants

VERSION

Public Class Methods

collapse(str) click to toggle source

Converts and compresses ASCII and Unicode whitespace into single spaces.

@param [String] str @return [String]

# File lib/scrubba.rb, line 18
def self.collapse(str)
  str.gsub(/[[:space:]]+/, " ") if str
end
strip(str) click to toggle source

Removes leading and trailing whitespace from a string.

@param [String] str @return [String]

# File lib/scrubba.rb, line 10
def self.strip(str)
  str.gsub(/(\A[[:space:]]+|[[:space:]]+\z)/, "") if str
end