Module: Flame::Render
- Included in:
- Controller
- Defined in:
- lib/flame/render.rb
Overview
Helper for render functionality
Instance Method Summary collapse
- #view(path, options = {}) ⇒ Object (also: #render)
Instance Method Details
#view(path, options = {}) ⇒ Object Also known as: render
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/flame/render.rb', line 6 def view(path, = {}) ## Take options for rendering scope = .delete(:scope) || self layout = .delete(:layout) || 'layout.*' ## And get the rest variables to locals locals = .merge(.delete(:locals) || {}) ## Find filename filename = find_file(path) ## Compile Tilt to instance hash @tilts ||= {} @tilts[filename] ||= Tilt.new(filename) ## Render Tilt from instance hash with new options layout_render layout, @tilts[filename].render(scope, locals) end |