Sha256: 18e603dfb35149fb62a0672c53348b052d8bf675c5620045e6a393dbb3346c17
Contents?: true
Size: 441 Bytes
Versions: 9
Compression:
Stored size: 441 Bytes
Contents
# == Synopsis # add an elapse_time_s method to Numeric class Numeric my_extension("elapsed_time_s") do # return String formated as "HH:MM:SS" def elapsed_time_s seconds = self hours = minutes = 0 hours = seconds.div 3600 seconds = seconds - (hours * 3600) minutes = seconds.div 60 seconds = seconds - (minutes * 60) sprintf("%2.2d:%2.2d:%2.2d", hours, minutes, seconds) end end end
Version data entries
9 entries across 9 versions & 2 rubygems