Module: Sequel::Plugins::InstanceHooks::InstanceMethods

Defined in:
lib/sequel/plugins/instance_hooks.rb

Instance Method Summary collapse

Instance Method Details

#after_destroyObject

Run after destroy instance hooks.



52
53
54
55
56
57
58
# File 'lib/sequel/plugins/instance_hooks.rb', line 52

def after_destroy
  super
  return unless @instance_hooks
  run_after_instance_hooks(:after_destroy)
  @instance_hooks.delete(:after_destroy)
  @instance_hooks.delete(:before_destroy)
end

#after_saveObject

Run after save instance hooks.



68
69
70
71
72
73
74
75
76
# File 'lib/sequel/plugins/instance_hooks.rb', line 68

def after_save
  super
  return unless @instance_hooks
  run_after_instance_hooks(:after_save)
  @instance_hooks.delete(:after_save)
  @instance_hooks.delete(:before_save)
  @instance_hooks.delete(:after_validation)
  @instance_hooks.delete(:before_validation)
end

#after_validationObject

Run after validation instance hooks.



61
62
63
64
65
# File 'lib/sequel/plugins/instance_hooks.rb', line 61

def after_validation
  super
  return unless @instance_hooks
  run_after_instance_hooks(:after_validation)
end

#before_destroyObject

Run before_destroy instance hooks.



79
80
81
82
83
# File 'lib/sequel/plugins/instance_hooks.rb', line 79

def before_destroy
  return super unless @instance_hooks
  run_before_instance_hooks(:before_destroy)
  super
end

#before_saveObject

Run before_save instance hooks.



86
87
88
89
90
# File 'lib/sequel/plugins/instance_hooks.rb', line 86

def before_save
  return super unless @instance_hooks
  run_before_instance_hooks(:before_save)
  super
end