Convert seconds to compound duration: Difference between revisions

m
(→‎{{header|Ruby}}: add ruby sample)
Line 975:
h, rem = rem.divmod(HOUR)
m, s = rem.divmod(MINUTE)
units = ["#{w} wk", "#{d} d", "#{h} h", "#{m} min", "#{s} sec"]
units.reject{|str| str.start_with?("0")}.join(", ")
end
1,149

edits