Addicted to Ruby

GiguToday first time in my life I decided to write small Ruby script instead of using COPY, PASTE. Does it mean that I’m a geek now?

I needed to get some data from a web site. Because data was nicely formatted in table I could just mark it, copy and then paste in spreadsheet tool. What I did instead was a little script that loaded the page, parsed table rows, extracted the data and saved it to a csv file. There is a nice library for HTML parsing called Hpricot. If anyone is doing some HTML, XHTML parsig in Ruby I do strongly recommend. Very simple parsing based on document tree.

Short example, to get all link elements from this blog I would do something like that:

document = open(‘http://blog.gigoo.org’) { |opened_uri| Hpricot(opened_uri) }

link_elements = document.search(“a”)

Voila 🙂

So, why addicted

I think I became addicted. Got the Ruby bug on me now. I like it more and more. Still trying to keep away from Rails just play with language and it’s features. I love big number of useful tools and libraries and the fact that community is working hard to make great stuff for it.

What I don’t like is the fact that everything is design and created with Rails on mind. I hope that Ruby is not going to be “the Rails language” and that people are going to remember that it’s not only about WEB (well, almost all the time is).

Cheerios and other cereals, Gregster