Method: Capnotify::Component#render_content

Defined in:
lib/capnotify/component.rb

#render_content(format) ⇒ Object

FIXME: this should probably leverage Procs for rendering of different types, maybe?

that would give a lot of power to a developer who wants a custom format for a plugin (eg XML or JSON)

Render the content in the given format using the right built-in template. Returns the content as a string. In the event that there is not a valid template, return an empty string.



52
53
54
55
56
57
58
# File 'lib/capnotify/component.rb', line 52

def render_content(format)
  begin
    ERB.new( File.open( template_path_for(format) ).read, nil, '%<>' ).result(self.get_binding)
  rescue TemplateUndefined
    ''
  end
end