Gotta love Ruby!

Ruby is an awesome, powerful little language.

I needed a 'time' command for windows to measure the execution time (in seconds) of a command. Should be trivial, but I'm not Windows API savvy. Here's the full script in Ruby:


t1 = Time.new
IO.popen(ARGV.join(' ')) { |pipe| puts pipe.gets }
t2 = Time.new

puts "Execution time: #{t2 - t1} seconds"


Simple, direct, and obvious. LOVE IT!

Comments

Popular posts from this blog

Review: The Southeast Christian Church Easter Pageant

Driving for the Cure...? (Or, how I got blacklisted...)

No, I don't have Connective Tissue Disorder