Class: HrtBus::Parse

Inherits:
Object
  • Object
show all
Defined in:
lib/hrt_bus/parse.rb

Class Method Summary collapse

Class Method Details

.geo(data) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/hrt_bus/parse.rb', line 12

def self.geo(data)
  return if data.nil?

  lat, lon = data.split("/")
  lat = lat.insert(2, ".")
  lon = lon.insert(3, ".")

  [lat, lon]
end

.time(time, date) ⇒ Object



5
6
7
8
9
10
# File 'lib/hrt_bus/parse.rb', line 5

def self.time(time, date)
  return if time.nil? || date.nil?

  data = [time, date].join(" ")
  DateTime.strptime(data, '%H:%M:%S %m/%d')        
end