nesquena/rabl — pull request #220 by ivanvanderbyl (2012-04-14 07:32:09+00:00)
Title: Added a general purpose rendering class for using Rabl outside of a framwork

Added Rabl::Renderer, a general purpose rendering class. Uses Rabl's internals for template lookup etc.

I've previously had to hack together nasty wrappers around Rabl to do :json and :xml rendering for message queue payloads and custom API calls, it was never nice, but it did work. This is much nicer.

My use case is custom Grape presenters for our public API and custom payloads for out backend message queue, all rendered from .rabl templates.

Usage:
```ruby
Rabl.render(object, template, :view_path => 'app/views', :format => :json) #=> "{...json..}"
Rabl::Renderer.json(object, template)
Rabl::Renderer.xml(object, template)
Rable::Renderer.new(template, object, options)
```