Class: Yoda::Store::Objects::PatchSet::AddressIndex
- Inherits:
-
Object
- Object
- Yoda::Store::Objects::PatchSet::AddressIndex
- Defined in:
- lib/yoda/store/objects/patch_set.rb
Instance Method Summary collapse
- #delete(patch) ⇒ void
- #get(address) ⇒ Set<Symbol>
-
#initialize ⇒ AddressIndex
constructor
A new instance of AddressIndex.
- #keys ⇒ Set<Symbol>
- #register(patch) ⇒ void
Constructor Details
#initialize ⇒ AddressIndex
Returns a new instance of AddressIndex.
10 11 12 |
# File 'lib/yoda/store/objects/patch_set.rb', line 10 def initialize @index = Hash.new end |
Instance Method Details
#delete(patch) ⇒ void
This method returns an undefined value.
36 37 38 39 40 |
# File 'lib/yoda/store/objects/patch_set.rb', line 36 def delete(patch) patch.keys.each do |key| (index[key.to_sym] || []).delete(patch.id.to_sym) end end |
#get(address) ⇒ Set<Symbol>
16 17 18 |
# File 'lib/yoda/store/objects/patch_set.rb', line 16 def get(address) index[address] ||= Set.new end |
#keys ⇒ Set<Symbol>
21 22 23 |
# File 'lib/yoda/store/objects/patch_set.rb', line 21 def keys index.keys end |
#register(patch) ⇒ void
This method returns an undefined value.
27 28 29 30 31 32 |
# File 'lib/yoda/store/objects/patch_set.rb', line 27 def register(patch) patch.keys.each do |key| index[key.to_sym] ||= Set.new index[key.to_sym].add(patch.id.to_sym) end end |