Module: Tipsy::Helpers::Rendering

Includes:
Capture
Included in:
Tipsy::Helpers
Defined in:
lib/tipsy/helpers/rendering.rb

Instance Method Summary collapse

Methods included from Capture

#capture, #content_for, #content_for?

Instance Method Details

#public_pathObject



6
7
8
# File 'lib/tipsy/helpers/rendering.rb', line 6

def public_path
  Tipsy::Site.config.public_path
end

#render(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tipsy/helpers/rendering.rb', line 10

def render(options = {})
  options.symbolize_keys!
  assert_valid_keys!(options, :ssi, :template, :partial, :collection, :locals)
  
  if template = options.delete(:template)
    render_inline_template(template, options)
  elsif template = options.delete(:partial)
    render_inline_template(template, options, true)
  elsif template = options.delete(:ssi)
    if Tipsy.compiling?
      ssi_path = Pathname.new(template).absolute? ? template : "/#{template}"
      return "<!--#include virtual=\"#{ssi_path}\" -->"
    end
    render_inline_template(template, options)
  else
    raise 'Render requires a :ssi, :template, or :partial option.'
  end
end