Class: TokyoMetro::Api::TrainLocation::List
- Inherits:
-
MetaClass::RealTime::List
- Object
- Array
- MetaClass::Fundamental::List
- MetaClass::RealTime::List
- TokyoMetro::Api::TrainLocation::List
- Includes:
- ClassNameLibrary::Api::TrainLocation
- Defined in:
- lib/tokyo_metro/api/train_location/list.rb
Overview
各列車のロケーション情報を格納する配列
Instance Method Summary collapse
- #before_decorate ⇒ Object
- #decorate(request, railway_line) ⇒ Object
- #exclude_toei_mita_line ⇒ Object
- #max_delay ⇒ Object
- #update!(http_client, railway_line, time: ::TokyoMetro.time_now) ⇒ Object
Methods inherited from MetaClass::RealTime::List
Methods inherited from MetaClass::Fundamental::List
Instance Method Details
#before_decorate ⇒ Object
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_line ⇒ Object
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_delay ⇒ Object
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 |