Sha256: c3f8f697fb4df332bf5f0f6b6d1cb995ea15a5fb98156ee2f539c6529c38af0e
Contents?: true
Size: 939 Bytes
Versions: 13
Compression:
Stored size: 939 Bytes
Contents
module Jekyll class LiquidRenderer class File def initialize(renderer, filename) @renderer = renderer @filename = filename end def parse(content) measure_time do @template = Liquid::Template.parse(content) end self end def render(*args) measure_time do measure_bytes do @template.render(*args) end end end def render!(*args) measure_time do measure_bytes do @template.render!(*args) end end end private def measure_bytes yield.tap do |str| @renderer.increment_bytes(@filename, str.bytesize) end end def measure_time before = Time.now yield ensure after = Time.now @renderer.increment_time(@filename, after - before) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems