Module: Roy::Render::InstanceMethods

Defined in:
lib/roy/render.rb

Instance Method Summary collapse

Instance Method Details

#render(engine, view_or_string, params = {}, &block) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/roy/render.rb', line 37

def render(engine, view_or_string, params={}, &block)
  options = conf.render || {}
  template = case view_or_string
    when Symbol
      file = [view_or_string.to_s, engine].map(&:to_s).join('.')
      dir = conf.views || 'views'
      Tilt.new(File.join(dir, file), nil, options)
    else
      Tilt[engine].new(nil, nil, options) { view_or_string.to_s }
    end

  template.render(app, params, &block)
end