Skip to content

Instantly share code, notes, and snippets.

@jwilger
Created June 12, 2012 22:11
Show Gist options
  • Save jwilger/2920443 to your computer and use it in GitHub Desktop.
Save jwilger/2920443 to your computer and use it in GitHub Desktop.
def my_method(options = {})
observer = options.delete(:observer)
x = SomeObservable.new
x.add_observer(*observer)
end
# works with
my_method(:observer => some_object)
# and also with
my_method(:observer => [some_object, :non_default_update_method])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment