Sha256: 0d91e5dda1e96401788dba89e234516b2bf09f2a371e604b7251d35d569959c7
Contents?: true
Size: 642 Bytes
Versions: 13
Compression:
Stored size: 642 Bytes
Contents
# frozen_string_literal: true require_relative 'template' module Tilt # The template source is evaluated as a Ruby string. The #{} interpolation # syntax can be used to generated dynamic output. class StringTemplate < Template def prepare hash = "TILT#{@data.hash.abs}" @freeze_string_literals = !!@options[:freeze] @code = String.new("<<#{hash}.chomp\n#{@data}\n#{hash}") end def precompiled_template(locals) @code end def precompiled(locals) source, offset = super [source, offset + 1] end def freeze_string_literals? @freeze_string_literals end end end
Version data entries
13 entries across 12 versions & 5 rubygems