Class: AssetsInclude::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/assets_include/cache.rb

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



3
4
5
# File 'lib/assets_include/cache.rb', line 3

def initialize
  @store = {}
end

Instance Method Details

#add(key, &block) ⇒ Object



7
8
9
# File 'lib/assets_include/cache.rb', line 7

def add(key, &block)
  store[key] ||= yield
end

#emptyObject



15
16
17
# File 'lib/assets_include/cache.rb', line 15

def empty
  store.clear
end

#get(key) ⇒ Object



11
12
13
# File 'lib/assets_include/cache.rb', line 11

def get(key)
  store[key]
end