Class: Clowne::Utils::Plan::TwoPhaseSet

Inherits:
Object
  • Object
show all
Defined in:
lib/clowne/utils/plan.rb

Instance Method Summary collapse

Constructor Details

#initializeTwoPhaseSet

Returns a new instance of TwoPhaseSet.



7
8
9
10
# File 'lib/clowne/utils/plan.rb', line 7

def initialize
  @added = {}
  @removed = []
end

Instance Method Details

#[]=(k, v) ⇒ Object



12
13
14
15
16
# File 'lib/clowne/utils/plan.rb', line 12

def []=(k, v)
  return if @removed.include?(k)

  @added[k] = v
end

#delete(k) ⇒ Object



18
19
20
21
22
23
# File 'lib/clowne/utils/plan.rb', line 18

def delete(k)
  return if @removed.include?(k)

  @removed << k
  @added.delete(k)
end

#valuesObject



25
26
27
# File 'lib/clowne/utils/plan.rb', line 25

def values
  @added.values
end