Class: Text::Gen::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/text/gen/store.rb

Overview

Store is a local cache of a builder that is persistent per store to save time on database lookups or transformations.

Instance Method Summary collapse

Constructor Details

#initializeStore

Returns a new instance of Store.



8
9
10
# File 'lib/text/gen/store.rb', line 8

def initialize
  @store = {}
end

Instance Method Details

#add(key, builder) ⇒ Object



16
17
18
# File 'lib/text/gen/store.rb', line 16

def add(key, builder)
  @store[key.to_s.downcase] = builder
end

#find(key) ⇒ Object



12
13
14
# File 'lib/text/gen/store.rb', line 12

def find(key)
  @store[key.to_s.downcase]
end

#to_hObject



20
21
22
# File 'lib/text/gen/store.rb', line 20

def to_h
  @store
end