Sha256: f57b22ab8650a09f6df06ff7fcda4b931bfbed5192132a2eb7f1eb0b401f0219
Contents?: true
Size: 918 Bytes
Versions: 1
Compression:
Stored size: 918 Bytes
Contents
module Expressr class Renderer class << self attr_accessor :engine def renderer if engine != Expressr::App.settings['view engine'] @renderer = get_renderer else @renderer ||= get_renderer end end def get_renderer self.engine = engines[Expressr::App.settings['view engine']] raise "Invalid view engine value: #{engine}" unless engine klass = Expressr::Utils.constantize(engine) klass.new end def engines { 'haml' => 'Expressr::Renderers::Haml', 'slim' => 'Expressr::Renderers::Slim' } end end def render(path, locals={}) path = App.settings['root'].join(App.settings['views'], path) locals = App.settings['locals'].merge(locals) renderer.render(path, locals) end def renderer self.class.renderer end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
expressr-0.0.3 | lib/expressr/renderer.rb |