Class: Codeowners::Storage::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/codeowners/storage/data.rb

Instance Method Summary collapse

Constructor Details

#initialize(data, collections: COLLECTIONS) ⇒ Data

Returns a new instance of Data.



11
12
13
14
15
# File 'lib/codeowners/storage/data.rb', line 11

def initialize(data, collections: COLLECTIONS)
  @data = collections.each_with_object({}) do |name, memo|
    memo[name] = Collection.new(data.fetch(name, []))
  end
end

Instance Method Details

#[](name) ⇒ Object



17
18
19
# File 'lib/codeowners/storage/data.rb', line 17

def [](name)
  data.fetch(name.to_s)
end

#dumpObject



21
22
23
# File 'lib/codeowners/storage/data.rb', line 21

def dump
  data.transform_values(&:dump)
end