tilt-jbuilder
Adds support for rendering Jbuilder templates using Tilt.
Installation
Add this line to your application's Gemfile:
gem 'tilt-jbuilder'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tilt-jbuilder
Usage
require 'tilt/jbuilder.rb'
template = Tilt::JbuilderTemplate.new("templates/awesomeness.json.jbuilder")
template.render
template = Tilt::JbuilderTemplate.new { "json.author name" }
template.render(nil, :name => 'Anthony')
template = Tilt::JbuilderTemplate.new { "json.author @name" }
scope = Object.new
scope.instance_variable_set :@name, 'Anthony'
template.render(scope)
template = Tilt::JbuilderTemplate.new do |t|
lambda { |json| json.author 'Anthony'; json.target! }
end
template.render
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Credits
tilt-jbuilder is maintained and funded by Sticksnleaves
Thanks to all of our contributors