Module: Reorm::SpecifyEventHandlers
- Includes:
- EventData
- Defined in:
- lib/reorm/modules/event_modules.rb
Instance Method Summary collapse
- #after_create(*methods) ⇒ Object
- #after_delete(*methods) ⇒ Object
- #after_save(*methods) ⇒ Object
- #after_update(*methods) ⇒ Object
- #after_validate(*methods) ⇒ Object
- #before_create(*methods) ⇒ Object
- #before_delete(*methods) ⇒ Object
- #before_save(*methods) ⇒ Object
- #before_update(*methods) ⇒ Object
- #before_validate(*methods) ⇒ Object
- #store_event_handlers(event, *methods) ⇒ Object
Instance Method Details
#after_create(*methods) ⇒ Object
14 15 16 |
# File 'lib/reorm/modules/event_modules.rb', line 14 def after_create(*methods) store_event_handlers(:after_create, *methods) end |
#after_delete(*methods) ⇒ Object
18 19 20 |
# File 'lib/reorm/modules/event_modules.rb', line 18 def after_delete(*methods) store_event_handlers(:after_delete, *methods) end |
#after_save(*methods) ⇒ Object
22 23 24 |
# File 'lib/reorm/modules/event_modules.rb', line 22 def after_save(*methods) store_event_handlers(:after_save, *methods) end |
#after_update(*methods) ⇒ Object
26 27 28 |
# File 'lib/reorm/modules/event_modules.rb', line 26 def after_update(*methods) store_event_handlers(:after_update, *methods) end |
#after_validate(*methods) ⇒ Object
30 31 32 |
# File 'lib/reorm/modules/event_modules.rb', line 30 def after_validate(*methods) store_event_handlers(:after_validate, *methods) end |
#before_create(*methods) ⇒ Object
34 35 36 |
# File 'lib/reorm/modules/event_modules.rb', line 34 def before_create(*methods) store_event_handlers(:before_create, *methods) end |
#before_delete(*methods) ⇒ Object
38 39 40 |
# File 'lib/reorm/modules/event_modules.rb', line 38 def before_delete(*methods) store_event_handlers(:before_delete, *methods) end |
#before_save(*methods) ⇒ Object
42 43 44 |
# File 'lib/reorm/modules/event_modules.rb', line 42 def before_save(*methods) store_event_handlers(:before_save, *methods) end |
#before_update(*methods) ⇒ Object
46 47 48 |
# File 'lib/reorm/modules/event_modules.rb', line 46 def before_update(*methods) store_event_handlers(:before_update, *methods) end |
#before_validate(*methods) ⇒ Object
50 51 52 |
# File 'lib/reorm/modules/event_modules.rb', line 50 def before_validate(*methods) store_event_handlers(:before_validate, *methods) end |
#store_event_handlers(event, *methods) ⇒ Object
54 55 56 57 58 |
# File 'lib/reorm/modules/event_modules.rb', line 54 def store_event_handlers(event, *methods) @@class_events[self] = {} if !@@class_events.include?(self) @@class_events[self][event] = [] if !@@class_events[self].include?(event) @@class_events[self][event] = @@class_events[self][event].concat(methods).uniq end |