So far, we've discussed how to use Sinatra in general, how to handle and route requests, and how to build views using Haml. Before we take the plunge into using data storage with Sinatra, let's put what we've discussed so far into practice. This article explains how to use Sinatra to provide a web interface for a gem.
The gems used in this article will be network-related gems, and will all be put together into a single application to provide an easy interface to all of them. The gem used will be whois as well as wrapping a command available on Linux such as traceroute. Though you don't have to have these installed, you will need them to run the code provided in this article without modification. You can also easily adapt any of this code to wrap any gems, methods or system commands you wish.