What makes my_method quite special is the ability to pass an arbitrary number of parameters (:arg1, :arg2...) followed by a list of keyword/value options.

This is made possible by a really helpful method provided by ActiveSupport called extract_options!. What this core extension does is to extract the options from the given set of arguments. When no options are available, the method returns a blank Hash.

extract_options! is largely used in every Rails project and you probably encountered it countless times. It powers the most part of Rails features you use every day including ActionController filters, ActiveRecord validations and finder methods.

extract_options! allows you to easily extract a list of options from an array of parameters, usually coming from a method invocation.

It isn't a standard Ruby method but a Rails Core Extension and you need to require ActiveSupport in order to use it. Also, beware that this is a "bang" method, hence it definitely modifies the object it is called on.