sonic-pi
https://github.com/sonic-pi-net/sonic-pi
C++
Code. Music. Live.
String#strip_heredoc
Strips indentation in heredocs.
For example in
if options[:usage]
puts <<-USAGE.strip_heredoc
This command does such and such.
Supported options are:
-h This message
...
USAGE
end
the user would see the usage message aligned against the left margin.
Technically, it looks for the least indented line in the whole string, and removes
that amount of leading whitespace.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/strip.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-String-strip_heredoc-for-pr
# Commit to gitgit add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/string/strip.rbgit commit -m "better docs for String#strip_heredoc"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-String-strip_heredoc-for-pr
hub pull-request
# Celebrate!