Class: Codeowners::Storage::Data
- Inherits:
-
Object
- Object
- Codeowners::Storage::Data
- Defined in:
- lib/codeowners/storage/data.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #dump ⇒ Object
-
#initialize(data, collections: COLLECTIONS) ⇒ Data
constructor
A new instance of Data.
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 |
#dump ⇒ Object
21 22 23 |
# File 'lib/codeowners/storage/data.rb', line 21 def dump data.transform_values(&:dump) end |