lib/rubyoshka/renderer.rb
# Caches the given block with the given arguments as cache key
# @param vary [*Object] cache key
# @param block [Proc] nested HTML block
# @return [void]
Caches the given block with the given arguments as cache key
Caches the given block with the given arguments as cache key
def cache(*vary, **opts, &block)
      key = [block.source_location.hash, vary.hash, opts.hash]
      if (cached = Rubyoshka.cache[key])
        @buffer << cached
        return
      end
      cache_pos = @buffer.length
      instance_eval(&block)
      diff = @buffer[cache_pos..-1]
      Rubyoshka.cache[key] = diff
    end
def cache ( * vary , ** opts , & block ) key = [ block . source_location . hash , vary . hash , opts . hash ] if ( cached = Rubyoshka . cache [ key ] ) @buffer << cached return end cache_pos = @buffer . length instance_eval ( & block ) diff = @buffer [ cache_pos .. - 1 ] Rubyoshka . cache [ key ] = diff end
Caches the given block with the given arguments as cache key
Caches the given block with the given arguments as cache key
None
void
vary
None
opts
<not_specific>
block
nested HTML block
nested HTML block