sonic-pi

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

C++

Code. Music. Live.

String#first

Returns the first character. If a limit is supplied, returns a substring
from the beginning of the string until it reaches the limit value. If the
given limit is greater than or equal to the string length, returns self.

  str = "hello"
  str.first    # => "h"
  str.first(1) # => "h"
  str.first(2) # => "he"
  str.first(0) # => ""
  str.first(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-first-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#first"


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

hub pull-request


# Celebrate!