Sha256: 96f470f6f39341f159bc33d7afc65c7437763acffb279840df367732e6439eab

Contents?: true

Size: 580 Bytes

Versions: 2

Compression:

Stored size: 580 Bytes

Contents

module Fetcher
  module Microdata
    module Twitter
      class Service
        include Singleton

        def created_at_to_timestamp created_at
          year = created_at[-4..-1].to_i
          month = created_at[4..6].downcase
          day = created_at[8..9].to_i

          time_fractioned = created_at[10..18].split ":"
          hour   = time_fractioned.shift.to_i
          minute = time_fractioned.shift.to_i
          second = time_fractioned.first.to_i
          
          Time.gm(year, month, day, hour, minute, second).to_i
        end
      end 
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fetcher-microdata-twitter-0.0.2 lib/fetcher/microdata/twitter/service.rb
fetcher-microdata-twitter-0.0.1 lib/fetcher/microdata/twitter/service.rb