Project

kerb

0.0
No commit activity in last 3 years
No release in over 3 years
Kerb renders ERB strings, templates and files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.8
~> 10.5
~> 3.4
 Project Readme

Kerb

Gem Version Build Status Code Climate Scrutinizer Code Quality

ERB rendering can be a like driving over a rocky road. This library aims to solve this problem by offering an easy interface to render ERB from a string, from a file or towards a file. Get off the road and onto the kerb!

Installation

Add this line to your application's Gemfile:

gem 'kerb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kerb

Usage

Render a string

erb = 'my <%= @foo %> <%= @bar %>'
vars = {
  foo: 'lovely',
  bar: 'garden'
}

Kerb.render(erb, vars) #=> "my lovely garden"

Render to a file

erb = 'my <%= @foo %> <%= @bar %>'
vars = {
  foo: 'lovely',
  bar: 'garden'
}
file = 'path_to_file'

Kerb.render_to_file(erb, vars, file)

File.read(file) #=> "my lovely garden"

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sebastiaandegeus/kerb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

Copyright (c) 2016 Sebastiaan de Geus

The gem is available as open source under the terms of the MIT License.