Class: Lifesaver::Notification::NotifiableAssociations
- Inherits:
-
Object
- Object
- Lifesaver::Notification::NotifiableAssociations
- Defined in:
- lib/lifesaver/notification/notifiable_associations.rb
Defined Under Namespace
Classes: AssociationKeys
Instance Method Summary collapse
- #any_to_notify? ⇒ Boolean
-
#initialize ⇒ NotifiableAssociations
constructor
A new instance of NotifiableAssociations.
- #on_change ⇒ Object
- #on_notify ⇒ Object
- #populate(associations, options = nil) ⇒ Object
Constructor Details
#initialize ⇒ NotifiableAssociations
Returns a new instance of NotifiableAssociations.
6 7 8 |
# File 'lib/lifesaver/notification/notifiable_associations.rb', line 6 def initialize @association_keys = AssociationKeys.new([], []) end |
Instance Method Details
#any_to_notify? ⇒ Boolean
32 33 34 |
# File 'lib/lifesaver/notification/notifiable_associations.rb', line 32 def any_to_notify? !on_notify.empty? end |
#on_change ⇒ Object
28 29 30 |
# File 'lib/lifesaver/notification/notifiable_associations.rb', line 28 def on_change association_keys.on_change end |
#on_notify ⇒ Object
24 25 26 |
# File 'lib/lifesaver/notification/notifiable_associations.rb', line 24 def on_notify association_keys.on_notify end |
#populate(associations, options = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lifesaver/notification/notifiable_associations.rb', line 10 def populate(associations, = nil) ||= {} add_associations(:on_change, associations) add_associations(:on_notify, associations) if [:only_on_change] add_associations(:on_change, [:only_on_change]) end if [:only_on_notify] add_associations(:on_notify, [:only_on_notify]) end end |