sonic-pi

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

C++

Code. Music. Live.

String#last

Returns the last character of the string. If a limit is supplied, returns a substring
from the end of the string until it reaches the limit value (counting backwards). If
the given limit is greater than or equal to the string length, returns self.

  str = "hello"
  str.last    # => "o"
  str.last(1) # => "o"
  str.last(2) # => "lo"
  str.last(0) # => ""
  str.last(6) # => "hello"

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/access.rb

Contribute

# Make a new branch

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


# Commit to git

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


# 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-last-for-pr

hub pull-request


# Celebrate!