Support for rendering Jbuilder templates in Tilt
Ruby
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec Added test for bug fix 'NameError - undefined local variable or method' Oct 6, 2015
.gitignore Ignoring .gems directory Jul 12, 2015
.travis.yml Updated travis config Aug 1, 2017
Gemfile
LICENSE First! Jun 9, 2012
README.md Fixed Sticksnleaves logo. Feb 4, 2015
Rakefile Configured rspec in Rakefile. Jun 9, 2012
tilt-jbuilder.gemspec

README.md

tilt-jbuilder

Adds support for rendering Jbuilder templates using Tilt.

Gem Version Build Status Dependency Status Coverage Status Code Climate

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

# With locals
template = Tilt::JbuilderTemplate.new { "json.author name" }
template.render(nil, :name => 'Anthony')

# With scope
template = Tilt::JbuilderTemplate.new { "json.author @name" }
scope = Object.new
scope.instance_variable_set :@name, 'Anthony'
template.render(scope)

# Block style
template = Tilt::JbuilderTemplate.new do |t|
  lambda { |json| json.author 'Anthony'; json.target! }
end
template.render

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Credits

Sticksnleaves

tilt-jbuilder is maintained and funded by Sticksnleaves

Thanks to all of our contributors