1. Technology
Send to a Friend via Email
You can opt-out at any time. Please refer to our privacy policy for contact information.

The Framework


Before we start plugging gems in and taking user input, let's get a bit of framework up. This includes a basic page layout the beginnings of an index page. The code presented in this article is completely without CSS styling and layout, as well as images as this is beyond the scope of this article.

In all, this is nothing you haven't seen before if you've read the previous article on Using Haml with Sinatra.

#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'haml'

get '/' do
  haml :index

@@ layout
    %title Network Tools
      %h1 Network Tools

@@ index
  Welcome to Network Tools. Below is a list
  of the tools available.
  1. About.com
  2. Technology
  3. Ruby
  4. Tutorials
  5. Sinatra
  6. The Framework

©2014 About.com. All rights reserved.