Class: Feedjira::DateTimeUtilities::DateTimeEpochParser

Inherits:
Object
  • Object
show all
Defined in:
lib/feedjira/date_time_utilities/date_time_epoch_parser.rb

Class Method Summary collapse

Class Method Details

.parse(string) ⇒ Object


6
7
8
9
10
11
# File 'lib/feedjira/date_time_utilities/date_time_epoch_parser.rb', line 6

def self.parse(string)
  epoch_time = string.to_i
  return Time.at(epoch_time).to_datetime if epoch_time.to_s == string

  raise "#{string} is not a valid epoch time"
end