Module: Sequel::Plugins::Wisper::InstanceMethods
- Defined in:
- lib/sequel/plugins/wisper.rb
Instance Method Summary collapse
- #after_commit ⇒ Object
- #after_create ⇒ Object
- #after_destroy ⇒ Object
- #after_destroy_commit ⇒ Object
- #after_destroy_rollback ⇒ Object
- #after_rollback ⇒ Object
- #after_save ⇒ Object
- #after_update ⇒ Object
- #after_validation ⇒ Object
- #around_validation ⇒ Object
- #before_create ⇒ Object
- #before_destroy ⇒ Object
- #before_save ⇒ Object
- #before_update ⇒ Object
- #before_validation ⇒ Object
- #save(*args) ⇒ Object
Instance Method Details
#after_commit ⇒ Object
82 83 84 85 |
# File 'lib/sequel/plugins/wisper.rb', line 82 def after_commit super broadcast(:after_commit, event_param) end |
#after_create ⇒ Object
53 54 55 56 57 58 |
# File 'lib/sequel/plugins/wisper.rb', line 53 def after_create super broadcast(:after_create, event_param) db.after_commit { broadcast(:"create_#{model_name}_successful", event_param) } db.after_rollback { broadcast(:"create_#{model_name}_failed", event_param) } end |
#after_destroy ⇒ Object
77 78 79 80 |
# File 'lib/sequel/plugins/wisper.rb', line 77 def after_destroy super broadcast(:after_destroy, event_param) end |
#after_destroy_commit ⇒ Object
92 93 94 95 96 |
# File 'lib/sequel/plugins/wisper.rb', line 92 def after_destroy_commit super broadcast(:after_destroy_commit, event_param) broadcast(:"destroy_#{model_name}_successful", event_param) end |
#after_destroy_rollback ⇒ Object
98 99 100 101 102 |
# File 'lib/sequel/plugins/wisper.rb', line 98 def after_destroy_rollback super broadcast(:after_destroy_rollback, event_param) broadcast(:"destroy_#{model_name}_failed", event_param) end |
#after_rollback ⇒ Object
87 88 89 90 |
# File 'lib/sequel/plugins/wisper.rb', line 87 def after_rollback super broadcast(:after_rollback, event_param) end |
#after_save ⇒ Object
43 44 45 46 |
# File 'lib/sequel/plugins/wisper.rb', line 43 def after_save super broadcast(:after_save, event_param) end |
#after_update ⇒ Object
65 66 67 68 69 70 |
# File 'lib/sequel/plugins/wisper.rb', line 65 def after_update super broadcast(:after_update, event_param) db.after_commit { broadcast(:"update_#{model_name}_successful", event_param) } db.after_rollback { broadcast(:"update_#{model_name}_failed", event_param) } end |
#after_validation ⇒ Object
33 34 35 36 |
# File 'lib/sequel/plugins/wisper.rb', line 33 def after_validation super broadcast(:after_validation, event_param) end |
#around_validation ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/sequel/plugins/wisper.rb', line 104 def around_validation res = super rescue => error res = nil ensure if on_save? && !res action = new? ? 'create' : 'update' broadcast(:"#{action}_#{model_name}_failed", event_param) end raise error if error end |
#before_create ⇒ Object
48 49 50 51 |
# File 'lib/sequel/plugins/wisper.rb', line 48 def before_create broadcast(:before_create, event_param) super end |
#before_destroy ⇒ Object
72 73 74 75 |
# File 'lib/sequel/plugins/wisper.rb', line 72 def before_destroy broadcast(:before_destroy, event_param) super end |
#before_save ⇒ Object
38 39 40 41 |
# File 'lib/sequel/plugins/wisper.rb', line 38 def before_save broadcast(:before_save, event_param) super end |
#before_update ⇒ Object
60 61 62 63 |
# File 'lib/sequel/plugins/wisper.rb', line 60 def before_update broadcast(:before_update, event_param) super end |
#before_validation ⇒ Object
28 29 30 31 |
# File 'lib/sequel/plugins/wisper.rb', line 28 def before_validation broadcast(:before_validation, event_param) super end |
#save(*args) ⇒ Object
24 25 26 |
# File 'lib/sequel/plugins/wisper.rb', line 24 def save(*args) on_save { super } end |