class Spirit::Render::Template
Base class for all templates. Class classes should override the template
class attribute.
Public Instance Methods
render(locals={})
click to toggle source
Renders the given problem using {#view}. @param [Hash] locals local variables to pass to the template
# File lib/spirit/render/templates/template.rb, line 15 def render(locals={}) view.render self, locals end
Private Instance Methods
view()
click to toggle source
Retrieves the view
singleton. If it is nil, initializes it from self.template
. Note that this is reloaded with every refresh so I can edit the templates without restarting. @todo TODO optimize by reusing the HAML engine @return [Haml::Engine] haml engine
# File lib/spirit/render/templates/template.rb, line 26 def view return @view unless @view.nil? file = File.join VIEWS, self.template @view = Haml::Engine.new File.read(file), HAML_CONFIG end