Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/videostore.rb
Instance Method Summary collapse
Instance Method Details
#youtube_duration_to_seconds ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/videostore.rb', line 182 def youtube_duration_to_seconds hours = match(/(\d+)H/) minutes = match(/(\d+)M/) seconds = match(/(\d+)S/) hours = hours ? hours[1].to_i : 0 minutes = minutes ? minutes[1].to_i : 0 seconds = seconds ? seconds[1].to_i : 0 (hours * 3600) + (minutes * 60) + seconds end |