class Yoda::Store::Objects::Patch
Attributes
id[R]
@param id [String]
registry[R]
@param registry [Hash{ Symbol => Addressable
}]
Public Class Methods
new(id, contents = nil)
click to toggle source
@param id [String] @param [Array, nil]
# File lib/yoda/store/objects/patch.rb, line 13 def initialize(id, contents = nil) @id = id @registry = (contents || []).map { |content| [content.address.to_sym, content] }.to_h end
Public Instance Methods
find(address)
click to toggle source
@param address [String, Symbol] @return [Addressable, nil]
# File lib/yoda/store/objects/patch.rb, line 30 def find(address) @registry[address.to_sym] end
has_key?(address)
click to toggle source
@param address [String, Symbol] @return [true, false]
# File lib/yoda/store/objects/patch.rb, line 36 def has_key?(address) @registry.has_key?(address.to_sym) end
keys()
click to toggle source
@return [Array<Symbol>]
# File lib/yoda/store/objects/patch.rb, line 41 def keys @registry.keys end
register(addressable)
click to toggle source
@param addressable [Addressable] @return [void]
# File lib/yoda/store/objects/patch.rb, line 20 def register(addressable) if el = @registry[addressable.address.to_sym] @registry[addressable.address.to_sym] = el.merge(addressable) else @registry[addressable.address.to_sym] = addressable end end