13 lines
168 B
Ruby
13 lines
168 B
Ruby
|
class Nanoc3::Site
|
||
|
def cached(key)
|
||
|
if cache.has_key?(key)
|
||
|
cache[key]
|
||
|
else
|
||
|
cache[key]= yield
|
||
|
end
|
||
|
end
|
||
|
def cache
|
||
|
@cache ||= {}
|
||
|
end
|
||
|
end
|