I finally got a small project that allowed me to utilize the Ruby language. It was a simple script to pull information from an Access database, put it in a flat file, and then upload it to an FTP site.
Normally I write jobs like this in Coldfusion. I know it’s better suited to web site development but it’s fast and easy to create little programs like the one I needed. In this case I did not have access to a Coldfusion server so I needed something that could run on it’s own. I chose Ruby for several reasons:
The first thing I noticed about Ruby is just how easy it is to work with strings. In Coldfusion I’m used to creating strings like this:
<cfset somevar = "#someval# foo foo">
The Ruby syntax is very similar:
somevar = "#{someval} foo foo"
Just like Coldfusion, Ruby makes it extremely easy to work with a wide variety of protocols through native APIs. SMTP, FTP, HTTP are available out of the box and extremely easy to use.
Coldfusion:
<cfhttp url="www.somesite.com/index.html" method="get">
Ruby:
Net::HTTP.get("www.somesite.com","/index.html")
One of Coldfusion’s greatest strengths has always been the community that surrounds it. Ruby is very similar in this respect. There are alot of talented and enthusiastic people working with Ruby. It shows in the number of available code samples and open-source libaries. It required a bit of searching but I found an example or ready made code for every problem I encountered.
That brings me to my one big complaint about Ruby. It was very difficult to find pure Ruby information. So many times I found myself using the “-rails” clause in my searches. Rails has become synonymous with Ruby so it’s not surprising. I’d just like to see more Ruby only information.
This was my first experience with Ruby and I’m pleased with the results. I feel like I have another tool that will allow me to quickly solve problems when Coldfusion is not an option.
An information technology professional with twenty five years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.
0 Comments