sonic-pi

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

C++

Code. Music. Live.

Array#extract_options!

Extracts options from a set of arguments. Removes and returns the last
element in the array if it's a hash, otherwise returns a blank hash.

  def options(*args)
    args.extract_options!
  end

  options(1, 2)        # => {}
  options(1, 2, a: :b) # => {:a=>:b}

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

Contribute

# Make a new branch

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


# Commit to git

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


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

hub pull-request


# Celebrate!