Module: ObjectCallbacks

Defined in:
lib/object_callbacks.rb,
lib/object_callbacks/version.rb

Constant Summary collapse

VERSION =
"0.0.3"

Instance Method Summary collapse

Instance Method Details

#after_call(action_name, options = {}) ⇒ Object



16
17
18
# File 'lib/object_callbacks.rb', line 16

def after_call(action_name, options = {})
  after_calls[action_name] = options
end

#before_call(action_name, options = {}) ⇒ Object



12
13
14
# File 'lib/object_callbacks.rb', line 12

def before_call(action_name, options = {})
  before_calls[action_name] = options
end

#method_added(action_name) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/object_callbacks.rb', line 4

def method_added(action_name)
  if actions.include?(action_name) || before_calls.key?(action_name) || after_calls.key?(action_name)
    return
  end

  apply_callback_actions(action_name)
end