Sha256: ca55ed0de30268da93b75dd00425064d4b55188aedfb0e572356cb3341d3f1da
Contents?: true
Size: 1010 Bytes
Versions: 1
Compression:
Stored size: 1010 Bytes
Contents
module Tilt class WLangTemplate < ::Tilt::Template class << self def engine_initialized? defined? ::WLang end def with_options(options) Class.new(WLangTemplate).tap{|c| c.default_options = options } end def default_options=(options) @default_options = options end def default_options (superclass.default_options rescue {}).merge(@default_options || {}) end end def initialize_engine require_template_library('wlang') end protected def prepare opts = self.class.default_options.merge(self.options) opts.merge!(:path => file) if file @engine = WLang::Template.new(data, opts) end def evaluate(scope, locals, &block) args = [scope] args << locals if locals && !(locals.respond_to?(:empty?) && locals.empty?) args << { :yield => block } if block @engine.render(*args) end end register WLangTemplate, 'wlang' end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wlang-2.3.1 | lib/wlang/tilt/wlang_template.rb |