Module: Queri::Helpers::TimeHelpers

Defined in:
lib/queri/helpers/time_helpers.rb

Class Method Summary collapse

Class Method Details

.time_string_to_seconds(time_string) ⇒ Object



4
5
6
7
# File 'lib/queri/helpers/time_helpers.rb', line 4

def self.time_string_to_seconds time_string
  base_60_digits = time_string[ (time_string.index(/\d/))..-1 ].split(?:).reverse.map(&:to_i)
  base_60_digits.map.with_index {|d,i| d * (60 ** i)}.reduce(:+)
end