Archive for June, 2009

Splash

 
icon for podpress  Splash: Play Now | Play in Popup | Download (219)
June 29, 2009 • Posted in: music • 2 Comments

Ruby Duration

Duration.new recieves a string describing a duration of time, and converts it into: seconds, and a standard readable format.
Or, you can pass Duration.new an integer representing seconds, and receive the same standard readable format.
Usage:
Passing a String

duration = Duration.new("2weeks 8 hr 30m")
duration.seconds # => 1240200
duration.readable # => "2 weeks, 8 hours and 30 [...]

June 12, 2009 • Posted in: Uncategorized • One Comment