Class | Rabl::Renderer |
In: |
lib/rabl/renderer.rb
|
Parent: | Object |
object | [R] | |
options | [R] |
Public: Instantiate a new renderer This is a standalone class used for rendering rabl templates outside of a framework like Rails. You may want to use this when using Rabl to render the request objects passed to message queues.
Example:
renderer = Rabl::Renderer.new('template_name', user, { :format => 'json', :view_path => 'app/views' }) renderer.render # => '{"user":{"name": "ivan" }}'
Public: Actually render the template to the requested output format.
Override the render context_scope to the 'context_scope' object. Defaults to self.
Returns: And object representing the tranformed object in the requested format.
e.g. json, xml, bson, plist
Internal: Returns the model name for an object
Example:
object.class.name # => User object_model_name => "user"