class Ekispert::Course::Route::Line::Stop::ArrivalState

Attributes

datetime[RW]
datetime_list[RW]

Public Class Methods

new(element) click to toggle source
Calls superclass method
# File lib/ekispert/course/route/line/stop/arrival_state.rb, line 9
def initialize(element)
  @datetime_list = []
  super(element)
end

Public Instance Methods

set_date(date) click to toggle source

Because of emptiness of date information at ArrivalState, set date additionaly ex. <Datetime operation=“today”>12:57:00+09:00</Datetime>

# File lib/ekispert/course/route/line/stop/arrival_state.rb, line 16
def set_date(date)
  time = @datetime_list[0].text.split(/[:\+]/).first(3).map(&:to_i)
  @datetime = DateTime.new(date.year, date.month, date.day, *time) rescue DateTime.now
  @datetime += 1 if @datetime_list[0].operation == 'yesterday'
end