Class: Yoda::Store::Objects::PatchSet::AddressIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/store/objects/patch_set.rb

Instance Method Summary collapse

Constructor Details

#initializeAddressIndex

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.

Parameters:



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>

Parameters:

  • address (Symbol)

Returns:

  • (Set<Symbol>)


16
17
18
# File 'lib/yoda/store/objects/patch_set.rb', line 16

def get(address)
  index[address] ||= Set.new
end

#keysSet<Symbol>

Returns:

  • (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.

Parameters:



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