Class: Tilt::StringTemplate

Inherits:
Template show all
Defined in:
lib/tilt/string.rb

Instance Attribute Summary

Attributes inherited from Template

#compiled_path, #data, #file, #line, #options

Instance Method Summary collapse

Methods inherited from Template

#basename, #compiled_method, default_mime_type, default_mime_type=, #eval_file, #fixed_locals?, #initialize, #metadata, metadata, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Instance Method Details

#freeze_string_literals?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/tilt/string.rb', line 31

def freeze_string_literals?
  @freeze_string_literals
end

#precompiled(locals) ⇒ Object



26
27
28
29
# File 'lib/tilt/string.rb', line 26

def precompiled(locals)
  source, offset = super
  [source, offset + 1]
end

#precompiled_template(locals) ⇒ Object



22
23
24
# File 'lib/tilt/string.rb', line 22

def precompiled_template(locals)
  @code
end

#prepareObject



16
17
18
19
20
# File 'lib/tilt/string.rb', line 16

def prepare
  hash = "TILT#{@data.hash.abs}"
  @freeze_string_literals = !!@options[:freeze]
  @code = String.new("<<#{hash}.chomp\n#{@data}\n#{hash}")
end