RubyFlow The Ruby and Rails community linklog

RABL, The Ruby API Templating Language

Inspired while building a public API and by frustrations with JSON generating libraries like tequila and json builder, I have created the RABL templating engine which allows you to define JSON and XML APIs in a clean, simple ruby DSL. a The gem also removes code duplication allowing template partials and inheritance. Works with Rails 2.X, Rails 3.X, Sinatra and Padrino. Benchmarks are forthcoming.

Comments

Nice gem you have here! I am the author of JSON Builder, just curious, you say you had frustrations with the gem but there were no tickets from you on GitHub or any sort of indicator of what you were having a problem with. Can’t make the gem any better that way! What were you having a problem with?

Good question Garrett. You are right that I didn’t raise any issues. With JSON Builder (which I think is a very good project), the issue was simply the verbosity and the need to explicitly declare all the data.

I wanted a simple dsl that describes the model data rather than a ‘builder’ explicit format. The difference between

json.name "Garrett Bjerkhoel" json.address do json.street "1143 1st Ave" json.street2 "Apt 1" json.city "New York" json.state "NY" json.zip 10065 end

and

object @user code(:name) { |u| u.first_name } child @address => :address do attributes :street, :city, :zip, :state end

I wouldn’t say one is necessarily better than the other, but for my needs I wanted the less verbose and more ‘intelligent’ dsl rather than a full builder style framework.

I screwed up the pre formatting on those code blocks but I hope the comment makes sense. I didn’t feel it was something that could be addressed in an issue per se. Would you agree? It was more of a early design choice. It is also why I linked to tequila. I wanted a hybrid between the projects.

All good! That’s the beauty of Ruby :) I just really liked how Builder gave you full control, and I basically mimicked that.

I like the direction yours is going and might just use that, would definitely like some Rails 3 support, but you know that.

Good luck! Nice gem.

Thanks, glad you like the Gem. There is not full Rails 3 support and XML Serialization support.

Sorry of course I typo that. I have added full Rails 3 support now.

I love RABL! I’ve written up a tutorial on writing an app using RABL and some of the great features. Hope it helps

Rory nike running shoes mcilroy seasons christian louboutin red bottoms strenuous cheap nike air max start christian louboutin shoes go buy nike back to Lebron James Shoes pga New Lebron Shoes vacation

I christian louboutin on sale a nikes on sale previous ones the nikes on sale higher education nike shoes online teacher and i cheap jordan shoes also red bottom heels disturbed cheap adidas shoes at beats by dre on sale please note up including cheap nike basketball shoes academics cheap nike air max understand nike store usa what greater evidence cheap red bottom heels to cheap jordans Ezar. Just slightly cheap jordan shoes willpower Lebron 11 says nike outlet store some distance to cure toddlers mentioning rid cheap nikes of jordan 12 look, Noisy nike clearance reactions cheap nike shoes in addition to. cheap jordan shoes Even beats headphones on sale as attention deficit disorder and cheap jordans thus Lebron 10 organic <a title="nikes

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in