module Eldr::Rendering
Constants
- VERSION
Public Class Methods
included(klass)
click to toggle source
# File lib/eldr/rendering.rb, line 27 def self.included(klass) klass.include Tags klass.include Output end
Public Instance Methods
find_template(path)
click to toggle source
# File lib/eldr/rendering.rb, line 18 def find_template(path) configuration.engine ||= 'slim' raise StandardError, 'Eldr::Rendering requires you to set config.views_dir' unless configuration.views_dir template = Pathname.new(File.join(configuration.views_dir, path)) template = Pathname.new(template.to_s + '.' + configuration.engine) if template.extname.blank? raise NotFound, 'Template Not Found' unless File.exist? template template.to_s end
render(path, resp_code = 200)
click to toggle source
# File lib/eldr/rendering.rb, line 14 def render(path, resp_code = 200) Rack::Response.new Tilt.new(find_template(path)).render(self), resp_code end