Sha256: a1e8fcc8a8827303e1e9404af48e25fcc5ec5571dd2916d313e3237c7bd62241
Contents?: true
Size: 1008 Bytes
Versions: 3
Compression:
Stored size: 1008 Bytes
Contents
module Bunto class LiquidRenderer class File def initialize(renderer, filename) @renderer = renderer @filename = filename end def parse(content) measure_time do @template = Liquid::Template.parse(content, line_numbers: true) 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bunto-3.0.0 | lib/bunto/liquid_renderer/file.rb |
bunto-2.0.0.pre | lib/bunto/liquid_renderer/file.rb |
bunto-1.0.0 | lib/bunto/liquid_renderer/file.rb |