Class: LazierData::ItemStore

Inherits:
Object
  • Object
show all
Defined in:
lib/lazier_data/item_store.rb

Constant Summary collapse

ITEMS_KEY =
:_lazier_data_items

Instance Method Summary collapse

Constructor Details

#initializeItemStore

Returns a new instance of ItemStore.



7
8
9
# File 'lib/lazier_data/item_store.rb', line 7

def initialize
  @store = new_layer
end

Instance Method Details

#[](key) ⇒ Object



19
20
21
# File 'lib/lazier_data/item_store.rb', line 19

def [](key)
  @store[key][ITEMS_KEY]
end

#dig(*path) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/lazier_data/item_store.rb', line 11

def dig(*path)
  if path.empty?
    @store[ITEMS_KEY]
  else
    @store.dig(*path)[ITEMS_KEY]
  end
end