Sha256: 0d1133ccf6b5f8410e15f41ce7e453d8214bd15a842987f07d3b632565e9d616
Contents?: true
Size: 1.11 KB
Versions: 103
Compression:
Stored size: 1.11 KB
Contents
require 'tilt' module Temple module Templates class Tilt < ::Tilt::Template extend Mixins::Template define_options mime_type: 'text/html' def self.default_mime_type options[:mime_type] end def self.default_mime_type=(mime_type) options[:mime_type] = mime_type end # Prepare Temple template # # Called immediately after template data is loaded. # # @return [void] def prepare opts = {}.update(self.class.options).update(options).update(file: eval_file) 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 # A string containing the (Ruby) source code for the template. # # @param [Hash] locals Local variables # @return [String] Compiled template ruby code def precompiled_template(locals = {}) @src end def self.register_as(*names) ::Tilt.register(self, *names.map(&:to_s)) end end end end
Version data entries
103 entries across 89 versions & 7 rubygems