Module: Kondi::Callbacks

Included in:
TableViewCell
Defined in:
lib/kondi/callbacks.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



3
4
5
# File 'lib/kondi/callbacks.rb', line 3

def self.included(receiver)
  receiver.extend(ClassMethods)
end

Instance Method Details

#run_after_callbacks(action, *args) ⇒ Object



11
12
13
# File 'lib/kondi/callbacks.rb', line 11

def run_after_callbacks(action, *args)
  run_callbacks(:after, action)
end

#run_before_callbacks(action, *args) ⇒ Object



7
8
9
# File 'lib/kondi/callbacks.rb', line 7

def run_before_callbacks(action, *args)
  run_callbacks(:before, action)
end

#run_callbacks(before_or_after, action, *args) ⇒ Object



15
16
17
18
19
# File 'lib/kondi/callbacks.rb', line 15

def run_callbacks(before_or_after, action, *args)
  self.class._callbacks_for(before_or_after, action).each do |method_name|
    send(method_name, *args)
  end
end