Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A template engine for hypermedia resources
Ruby JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.document
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE.txt
README.rdoc
Rakefile
VERSION

README.rdoc

tokamak

Tokamak is a hypermedia template engine created to enpower Restfulie.

Get it on baby!

Based on Cipriani's example on the Restfulie mailing list, this is a simple Tokamak description:

collection(@activities) do |collection|

collection.members do |m, activity| member.values { |v| v.id = activity.id } member.link “similar”, url_for activity.similar end

end

There is an entire chapter on tokamak usage on Restfulie's documentation. Go for it! If it still does not show what you want to generate, feel free to ask at Restfulie's mailing list.

A full bodied example

collection(@activities) do |collection|
  collection.members do |member, activity|
    member.values { |values|

     values.id           activity.id
     values.title        activity.title

     values.actor { 
        values.type activity.actor_type.downcase
        values.id   activity.actor_id
     }

     values.verbs  activity.verbs

     values.object {
       values.type activity.object_type.downcase
       values.id   activity.object_id 
       values.content activity.object.content if activity.object_content?
     } 

     if activity.indirect_object
       values.indirect_object {
         values.type activity.indirect_object_type.downcase
         values.id   activity.indirect_object_id
       }
     end
   }

  end
end

Team

It was created by the team who contributed to Restfulie.

Contributing to tokamak

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright © 2010 Guilherme Silveira. See LICENSE.txt for further details.

Something went wrong with that request. Please try again.