stonean

trying to be better than I was yesterday

RuHL

If you like and use RuHL, please vote for it on RubyTrends

Available on gemcutter

The gist comparing Erb, Mustache and RuHL

What is RuHL?

RuHL is an opinionated attribute language.

Here’s a quick example:

<html>
  <body>
    <p data-ruhl="say_hello"/>
  </body>
</html>

There is a method defined as (available to self):

def say_hello
  "Hello World"
end

Then you call:

Ruhl::Engine.new(File.read(‘hello_world.ruhl’)).render(self)

The result would be:

<html>
  <body>
    <p>Hello World</p>
  </body>
</html>

This is obviously a simple example, but I just wanted to give you an idea of what RuHL is.

Philosophy

RuHL’s mission is to reduce the amount of code used in your view. I believe code in views is a bad practice. The restrictions enforced by RuHL are intended to guide the user to better code architecture. An unplanned revelation of this premise was that this makes testing your application easier. More on this later.

Index

  1. Rails
  2. RSpec
  3. Sinatra
  4. The Options
  5. The Reserved Words

Github

Yes, it’s on Github. If you would like to report an issue or want to make a feature request, please use github’s issue tracker on the RuHL project page.

License

RuHL is free to use under the terms of the MIT license.

Copyright © 20010 Andrew Stone

Copyright © 2010 stonean. All rights reserved.
Powered by Thoth.