Sha256: 0ef6b538bd114ffd54f515fed4ff6563cb8ded8734eb3be77686189bdb793538
Contents?: true
Size: 804 Bytes
Versions: 1
Compression:
Stored size: 804 Bytes
Contents
module Stachio Mustache.raise_on_context_miss = true class Template < ActiveRecord::Base lookup_by :template_name attr_accessible :template_name, :content validates_presence_of :template_name, :content attr_accessor :presents, :rendered def reset self.rendered = nil end def render(options={}) options = options.with_indifferent_access reset if !!(options[:force] or options[:reset]) self.rendered ||= Mustache.render(content, presents) unless presents.nil? end alias_method :assemble, :render alias_method :composite, :render alias_method :compose, :render def present(values=nil, options={}) return render if values.nil? self.presents = values render options.merge(:force => true) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stachio-0.0.3 | app/models/stachio/template.rb |