Sha256: 6a22493d217be8eaf0018a176334ec7cbe74f985a81866410b3641c957910f68
Contents?: true
Size: 734 Bytes
Versions: 6
Compression:
Stored size: 734 Bytes
Contents
Treetop.load File.dirname(__FILE__) + '/slippers' module Slippers class Engine def initialize(template, params={}) @main_template = Slippers::Template.new(template) @template_group = params[:template_group] end attr_reader :main_template, :template_group def render(object_to_render=nil) parser = SlippersParser.new parse_tree = parser.parse(@main_template.template) return '' unless parse_tree parse_tree.eval(object_to_render, @template_group) end def eql?(other) @main_template.eql?(other.main_template) && @template_group.eql?(other.template_group) end def hash @main_template.hash + @template_group.hash*23 end end end
Version data entries
6 entries across 6 versions & 1 rubygems