Class: Temple::Templates::Tilt
- Extended by:
- Mixins::Template
- Defined in:
- lib/temple/templates/tilt.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#precompiled_template(locals = {}) ⇒ String
A string containing the (Ruby) source code for the template.
-
#prepare ⇒ void
Prepare Temple template.
Methods included from Mixins::Template
Methods included from Mixins::ClassOptions
#default_options, #define_deprecated_options, #define_options, #disable_option_validator!, #options, #set_default_options, #set_options
Class Method Details
.register_as(*names) ⇒ Object
34 35 36 |
# File 'lib/temple/templates/tilt.rb', line 34 def self.register_as(*names) ::Tilt.register(self, *names.map(&:to_s)) end |
Instance Method Details
#precompiled_template(locals = {}) ⇒ String
A string containing the (Ruby) source code for the template.
30 31 32 |
# File 'lib/temple/templates/tilt.rb', line 30 def precompiled_template(locals = {}) @src end |
#prepare ⇒ void
This method returns an undefined value.
Prepare Temple template
Called immediately after template data is loaded.
16 17 18 19 20 21 22 23 24 |
# File 'lib/temple/templates/tilt.rb', line 16 def prepare opts = {}.update(self.class.).update().update(file: eval_file) [:mime_type] = opts.delete(:mime_type) if opts.include?(:outvar) opts[:buffer] = opts.delete(:outvar) opts[:save_buffer] = true end @src = self.class.compile(data, opts) end |