Today 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
“What I dont like is the fact that everything is design and created with Rails on mind.”
I’m guessing you mean tools and libraries, etc. instead of the actual Ruby language itself.
I don’t think Ruby stands a chance of being the “rails” language except perhaps in the ill-informed public mind. With the exciting developments like Shoes and the existing plethora of gems available and in development that have nothing to do with the net, I’m continually excited about Ruby’s future.
Incidentally, Rails is awesome in and of itself, but also awesome because of how it shows ruby’s strengths and has started people thinking about what a web framework should and shouldn’t be. I also think Merb, etc. are great independent reactionary responses and improvements that ultimately benefit the language as a whole and help fight off the Railsification of Ruby 🙂
Enjoy your new love affair, Ruby is beautiful.
The same thing happened to me. I program in C# at work but I have Ruby as my prefered language. It’s really nice and yes, now you are a geek. Welcome!