sonic-pi

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

C++

Code. Music. Live.

Object#acts_like?

A duck-type assistant method. For example, Active Support extends Date
to define an <tt>acts_like_date?</tt> method, and extends Time to define
<tt>acts_like_time?</tt>. As a result, we can do <tt>x.acts_like?(:time)</tt> and
<tt>x.acts_like?(:date)</tt> to do duck-type-safe comparisons, since classes that
we want to act like Time simply need to define an <tt>acts_like_time?</tt> method.

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/object/acts_like.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Object-acts_like--for-pr


# Commit to git

git add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/object/acts_like.rbgit commit -m "better docs for Object#acts_like?"


# Open pull request

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

hub fork

git push <your name> -your-name--update-docs-Object-acts_like--for-pr

hub pull-request


# Celebrate!