sonic-pi

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

C++

Code. Music. Live.

Array#split

Divides the array into one or more subarrays based on a delimiting +value+
or the result of an optional block.

  [1, 2, 3, 4, 5].split(3)              # => [[1, 2], [4, 5]]
  (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]]

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/array/grouping.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Array-split-for-pr


# Commit to git

git add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/array/grouping.rbgit commit -m "better docs for Array#split"


# Open pull request

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

hub fork

git push <your name> -your-name--update-docs-Array-split-for-pr

hub pull-request


# Celebrate!