Module: ActionController::Caching::Fragments

Defined in:
lib/am_caching.rb

Instance Method Summary collapse

Instance Method Details

#cache_value_erb(basename, expiry = 0, args = {}, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/am_caching.rb', line 13

def cache_value_erb(basename, expiry=0, args={}, &block)        
  buffer = eval("_erbout", block.binding)

  if cache = cache_read(basename,args)
    buffer.concat(cache)
  else
    pos = buffer.length
    block.call
    cache_value(basename, expiry, args) do
      buffer[pos..-1]
    end
  end
end