Class: Synapse::ProcessManager::CorrelationSet
- Inherits:
-
Object
- Object
- Synapse::ProcessManager::CorrelationSet
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/synapse/process_manager/correlation_set.rb
Overview
Container that tracks additions and deletions of correlations for a process instance
Instance Attribute Summary collapse
- #additions ⇒ Set readonly
- #correlations ⇒ Set readonly
- #deletions ⇒ Set readonly
Instance Method Summary collapse
-
#add(correlation) ⇒ Boolean
Adds the given correlation to this set, if not previously added.
-
#commit ⇒ undefined
Resets the tracked changes.
-
#delete(correlation) ⇒ Boolean
Removes the given correlation from this set, if previously added.
-
#initialize ⇒ CorrelationSet
constructor
A new instance of CorrelationSet.
Constructor Details
#initialize ⇒ CorrelationSet
Returns a new instance of CorrelationSet.
17 18 19 20 21 |
# File 'lib/synapse/process_manager/correlation_set.rb', line 17 def initialize @correlations = Set.new @additions = Set.new @deletions = Set.new end |
Instance Attribute Details
#additions ⇒ Set (readonly)
12 13 14 |
# File 'lib/synapse/process_manager/correlation_set.rb', line 12 def additions @additions end |
#correlations ⇒ Set (readonly)
9 10 11 |
# File 'lib/synapse/process_manager/correlation_set.rb', line 9 def correlations @correlations end |
#deletions ⇒ Set (readonly)
15 16 17 |
# File 'lib/synapse/process_manager/correlation_set.rb', line 15 def deletions @deletions end |
Instance Method Details
#add(correlation) ⇒ Boolean
Adds the given correlation to this set, if not previously added
34 35 36 37 38 39 40 |
# File 'lib/synapse/process_manager/correlation_set.rb', line 34 def add(correlation) if @correlations.add? correlation unless @deletions.delete? correlation @additions.add correlation end end end |
#commit ⇒ undefined
Resets the tracked changes
25 26 27 28 |
# File 'lib/synapse/process_manager/correlation_set.rb', line 25 def commit @additions.clear @deletions.clear end |
#delete(correlation) ⇒ Boolean
Removes the given correlation from this set, if previously added
46 47 48 49 50 51 52 |
# File 'lib/synapse/process_manager/correlation_set.rb', line 46 def delete(correlation) if @correlations.delete? correlation unless @additions.delete? correlation @deletions.add correlation end end end |