Sha256: c778212344649e389cec7fe9334f219bdee9636ca0fd849fd940976ec3eea636

Contents?: true

Size: 625 Bytes

Versions: 8

Compression:

Stored size: 625 Bytes

Contents

require "time"

# Internal: This module is used to parse date_time strings returned by the
# Trivia Crack API.
module TriviaCrack
  module Parsers
    module TimeParser

      TIME_FORMAT = "%m/%d/%Y %H:%M:%S"

      # Internal: Parses a date_time string returned by the Trivia Crack API.
      #
      # raw_data - The date_time string.
      #
      # Examples
      #
      #   TriviaCrack::Parsers::TimeParser.parse "02/17/2015 21:47:19 EST"
      #
      # Returns a Time object representation of the given string.
      def self.parse(raw_data)
        Time.strptime(raw_data, TIME_FORMAT)
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
triviacrack-0.6.0 lib/triviacrack/parsers/time_parser.rb
triviacrack-0.5.1 lib/triviacrack/parsers/time_parser.rb
triviacrack-0.5.0 lib/triviacrack/parsers/time_parser.rb
triviacrack-0.4.0 lib/triviacrack/parsers/time_parser.rb
triviacrack-0.3.2 lib/triviacrack/parsers/time_parser.rb
triviacrack-0.3.0 lib/triviacrack/parsers/time_parser.rb
triviacrack-0.2.0 lib/triviacrack/parsers/time_parser.rb
triviacrack-0.1.0 lib/triviacrack/parsers/time_parser.rb