lib/pulse_meter/mixins/utils.rb
# Converts string of the form YYYYmmddHHMMSS (considered as UTC) to Time
# @param str [String] string to be converted
# @return [Time]
# @raise [ArgumentError] unless passed value responds to to_s
Converts string of the form YYYYmmddHHMMSS (considered as UTC) to Time
Converts string of the form YYYYmmddHHMMSS ( considered as UTC ) to Time
def parse_time(str)
        raise ArgumentError unless str.respond_to?(:to_s)
        m = str.to_s.match(/\A(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\z/)
        if m
          Time.gm(*m.captures.map(&:to_i))
        else
          raise ArgumentError, "`#{str}' is not a YYYYmmddHHMMSS time"
        end
      end
def parse_time ( str ) raise ArgumentError unless str . respond_to? ( :to_s ) m = str . to_s . match ( / \A ( \d {4})( \d {2})( \d {2})( \d {2})( \d {2})( \d {2}) \z / ) if m Time . gm ( * m . captures . map ( & :to_i ) ) else raise ArgumentError , "`#{str}' is not a YYYYmmddHHMMSS time" end end
Converts string of the form YYYYmmddHHMMSS (considered as UTC) to Time
Converts string of the form YYYYmmddHHMMSS ( considered as UTC ) to Time
None
Time
[ArgumentError] unless passed value responds to to_s
[ ArgumentError ] unless passed value responds to to_s
str
string to be converted
string to be converted