sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

String#squish

Returns the string, first removing all whitespace on both ends of
the string, and then changing remaining consecutive whitespace
groups into one space each.

Note that it handles both ASCII and Unicode whitespace like mongolian vowel separator (U+180E).

  %{ Multi-line
     string }.squish                   # => "Multi-line string"
  " foo   bar    \n   \t   boo".squish # => "foo bar boo"

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/string/filters.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-String-squish-for-pr


# Commit to git

git add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/string/filters.rbgit commit -m "better docs for String#squish"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-String-squish-for-pr

hub pull-request


# Celebrate!