Module: Paranoia::Callbacks

Defined in:
lib/paranoia.rb

Class Method Summary collapse

Class Method Details

.extended(klazz) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/paranoia.rb', line 49

def self.extended(klazz)
  klazz.define_callbacks :restore

  klazz.define_singleton_method("before_restore") do |*args, &block|
    set_callback(:restore, :before, *args, &block)
  end

  klazz.define_singleton_method("around_restore") do |*args, &block|
    set_callback(:restore, :around, *args, &block)
  end

  klazz.define_singleton_method("after_restore") do |*args, &block|
    set_callback(:restore, :after, *args, &block)
  end
end