Class: Fetcher::Microdata::Twitter::Service

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/fetcher/microdata/twitter/service.rb

Instance Method Summary collapse

Instance Method Details

#created_at_to_timestamp(created_at) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fetcher/microdata/twitter/service.rb', line 7

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