Praises for Ruport

Standard

Reports for Ruby!

 

I wanted to make a comment on the excellent report library Ruport, for the Ruby language. Today I installed the library using a simple gem command

C:> gem install ruport –y

What attracted me to Ruport was how easy it is to open comma separated value files (or simply put, flat text files) and generate a handsome report. For example, let’s suppose we have the following text file:

 

name,login time,machine

Gregory,10:00,bittle

Joe,11:45,soda

Jim,9:00,kitten

Joe,12:15,soda

Gregory,5:00,kitten

Joe,12:45,bittle

 

And this is not an original example, rather is one taken from Ruport’s website. But I hope the folks from Ruport don’t mind a little evangelizing!

 

We can generate a nice PDF report as easy as:

 

require “rubygems”

require “ruport”

t = Table(“foo.csv”)

grouping = Grouping(t, :by => “name”)

puts grouping.to_pdf

 

And that is all it takes. I could show you the PDF file that looks a lot like this:

 

Ruport makes PDF reports easy!

But then it is not as exciting as making the try yourself.

 

Generating HTML files to be viewed using a browser is also simple:

 

require “rubygems”

require “ruport”

t = Table(“foo.csv”)

grouping = Grouping(t, :by => “name”)

puts grouping.to_html

 

The result is a mark-up language file that will look like a table.

 

Another excellent tool for the happy Ruby hacker!

 

Advertisements

2 thoughts on “Praises for Ruport

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s