Class: Phenomenal::RelationshipManager
- Inherits:
-
Object
- Object
- Phenomenal::RelationshipManager
- Includes:
- Singleton
- Defined in:
- lib/phenomenal/relationship/relationship_manager.rb
Overview
This class manage the different relatiohsips in the system between contexts
Instance Attribute Summary collapse
-
#relationships ⇒ Object
Returns the value of attribute relationships.
Instance Method Summary collapse
- #activate_relationships(context) ⇒ Object
- #deactivate_relationships(context) ⇒ Object
-
#update_relationships_references(context) ⇒ Object
Called when a context is defined in the manager.
Instance Attribute Details
#relationships ⇒ Object
Returns the value of attribute relationships.
6 7 8 |
# File 'lib/phenomenal/relationship/relationship_manager.rb', line 6 def relationships @relationships end |
Instance Method Details
#activate_relationships(context) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/phenomenal/relationship/relationship_manager.rb', line 8 def activate_relationships(context) # Step 1: Import the new relationships for a feature if context.is_a?(Phenomenal::Feature) import_relationships(context) end # Step 2: Apply relationships relationships.get_for(context).each do |relationship| relationship.activate_context(context) end end |
#deactivate_relationships(context) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/phenomenal/relationship/relationship_manager.rb', line 19 def deactivate_relationships(context) # Step 1: Unapply relationships relationships.get_for(context).each do |relationship| relationship.deactivate_context(context) end # Step 2: Remove relationships if context.is_a?(Phenomenal::Feature) remove_relationships(context) end end |
#update_relationships_references(context) ⇒ Object
Called when a context is defined in the manager
31 32 33 |
# File 'lib/phenomenal/relationship/relationship_manager.rb', line 31 def update_relationships_references(context) relationships.update_references(context) end |