Class: TokyoMetro::Api::TrainLocation::List

Inherits:
MetaClass::RealTime::List show all
Includes:
ClassNameLibrary::Api::TrainLocation
Defined in:
lib/tokyo_metro/api/train_location/list.rb

Overview

各列車のロケーション情報を格納する配列

Instance Method Summary collapse

Methods inherited from MetaClass::RealTime::List

#valid?

Methods inherited from MetaClass::Fundamental::List

#find_by_same_as, #to_strf

Instance Method Details

#before_decorateObject



25
26
27
# File 'lib/tokyo_metro/api/train_location/list.rb', line 25

def before_decorate
  ::TokyoMetro::Factory::BeforeDecorate::Api::TrainLocation::List.new( self )
end

#decorate(request, railway_line) ⇒ Object



21
22
23
# File 'lib/tokyo_metro/api/train_location/list.rb', line 21

def decorate( request , railway_line )
  ::TokyoMetro::Factory::Decorate::Api::TrainLocation::List.new( request , self , railway_line )
end

#exclude_toei_mita_lineObject



29
30
31
32
33
# File 'lib/tokyo_metro/api/train_location/list.rb', line 29

def exclude_toei_mita_line
  self.class.new( self.select { | train_location_info |
    train_location_info.railway_line  != "odpt.Railway:Toei.Mita"
  } )
end

#max_delayObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/tokyo_metro/api/train_location/list.rb', line 10

def max_delay
  delays = self.map( &:delay )
  if delays.all?( &:blank? )
    nil
  elsif delays.all?( &:present? )
    delays.max
  else
    raise "Error"
  end
end

#update!(http_client, railway_line, time: ::TokyoMetro.time_now) ⇒ Object



6
7
8
# File 'lib/tokyo_metro/api/train_location/list.rb', line 6

def update!( http_client , railway_line , time: ::TokyoMetro.time_now )
  super( http_client , railway_line , time: time )
end