Sha256: acf5f2ac6fa003516cf83e3f3583808137080d186e93a65f8be376b761fa98a9

Contents?: true

Size: 580 Bytes

Versions: 3

Compression:

Stored size: 580 Bytes

Contents

module Fetcher
  class Microdata
    module Facebook
      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

3 entries across 3 versions & 1 rubygems

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