Tuesday, March 4, 2014

Ruby Tricks - Listing time spent in code

<some code>

@@t = ::Time.now

<more code>

puts "Time: " + (::Time.now-@@t).to_s +  "\n"

Note: the ::Time is only there because I ran into a conflict between the Time class in Ruby and the Time class in one of the gems I'm using.