Class: JSONFactory::TemplateStore

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/json_factory/template_store.rb

Instance Method Summary collapse

Constructor Details

#initializeTemplateStore

Returns a new instance of TemplateStore.



7
8
9
# File 'lib/json_factory/template_store.rb', line 7

def initialize
  @templates = {}
end

Instance Method Details

#clearObject



19
20
21
# File 'lib/json_factory/template_store.rb', line 19

def clear
  @templates.clear
end

#get(path) ⇒ Object



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

def get(path)
  if @templates.key? path
    @templates.fetch(path)
  else
    @templates.store(path, read_template(path))
  end
end