class Ez::Registry
Public Class Methods
data(key)
click to toggle source
# File lib/ez/registry.rb, line 29 def data(key) store(key).map(&:data) end
in(key, by:) { |store| ... }
click to toggle source
# File lib/ez/registry.rb, line 13 def in(key, by:) get_or_initialize_store_by(key) add!(yield(Registry::Store.new), to: store[key], by: by) end
store(key = nil)
click to toggle source
# File lib/ez/registry.rb, line 19 def store(key = nil) @store ||= {} if key @store[key] || Registry::Store.new else @store end end
Private Class Methods
add!(*collection, to:, by:)
click to toggle source
# File lib/ez/registry.rb, line 39 def add!(*collection, to:, by:) collection.flatten.each do |record| record.by = by to.push(record) end end
get_or_initialize_store_by(key)
click to toggle source
# File lib/ez/registry.rb, line 35 def get_or_initialize_store_by(key) store[key] || store[key] = Registry::Store.new end