Skip to content

Commit

Permalink
doc Class#observes
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgolick committed Aug 5, 2009
1 parent 96d287a commit 0460b3d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/observational.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
require 'observational/observable'

module Observational
##
# Declares an observer
#
# @param [Symbol] the name of the model to observe
# @param [Hash] opts observer options
# @option opts [Symbol] :invokes The method to invoke on the subscriber.
# @option opts [Symbol] :with The parameters to pass to the method that gets invoked.
# @option opts [Symbol] :on The action to observe. e.g. :after_create for an active_record object
# @option opts [Symbol] :after A shortcut for AR objects. :after => :create is the equivalent of :on => :after_create
# @option opts [Symbol] :before Same as :after
#
def observes(model_name, opts = {})
opts.assert_valid_keys :with, :invokes, :on, :before, :after

Expand Down

0 comments on commit 0460b3d

Please sign in to comment.