0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Need to replace some tokens? This is all you need (Ruby 1.9+).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme
 ___________________/\___________________
/                                        \

PencilMustache

Do you only need to replace some tokens? This is all you need (Ruby 1.9+). No need for 3000 lines of Ruby, like in Mustache proper.

Usage

Quick example (similar to Mustache):

>> require 'pencil_mustache' # Assuming it's in your $LOAD_PATH
=> true
>> PencilMustache.render("Hello {{planet}}!", :planet => "World")
=> "Hello World!"
>> PencilMustache.render("Hello {{planet}}!", :planet => "Omicron Persei 8")
=> "Hello Omicron Persei 8!"

Installing

It's so small (15 lines), you might as well copy it into your app. Or just use the same gsub feature when you need it.

But if you insist, it's a gem too:

gem install pencil_mustache

Don't need Mustache-like syntax? Try Kernel#sprintf which works similarly:

>> sprintf("Hello %{planet}!", :planet => "World")
=> "Hello World!"
>> sprintf("Hello %{planet}!", :planet => "Omicron Persei 8")
=> "Hello Omicron Persei 8!"
>> "Hello %{planet}!" % { :planet => "World" }
=> "Hello World!"

Contributing

Run the specs using:

ruby spec/pencil_mustache_spec.rb

Build the gem using:

gem build pencil_mustache.gemspec

License

MIT. See LICENSE for a copy.