class Tilt::StaticTemplate
end
@data.upcase
UppercaseTemplate = Tilt::StaticTemplate.subclass do
Basic example which transforms the template to uppercase:
method with a block which processes @data and returns the transformed value.
Instead of inheriting from the StaticTemplate class, you will use the .subclass
Static templates are templates that return the same output for every render
def self.subclass(mime_type: 'text/html', &block)
def self.subclass(mime_type: 'text/html', &block) Class.new(self) do self.default_mime_type = mime_type private define_method(:_prepare_output, &block) end end
def allows_script?
def allows_script? false end
def compiled_method(locals_keys, scope_class=nil)
Raise NotImplementedError, since static templates
def compiled_method(locals_keys, scope_class=nil) raise NotImplementedError end
def prepare
def prepare @output = _prepare_output end
def render(scope=nil, locals=nil)
def render(scope=nil, locals=nil) @output end
def set_compiled_method_cache
def set_compiled_method_cache end
def set_fixed_locals
def set_fixed_locals end