Sha256: d4152f9312ed67d2bef68ac6aa40435b0b54e179b002a6d76c743adb1dafe1ad

Contents?: true

Size: 962 Bytes

Versions: 1

Compression:

Stored size: 962 Bytes

Contents

# 各列車のロケーション情報を格納する配列
class TokyoMetro::Api::TrainLocation::List < TokyoMetro::Api::MetaClass::RealTime::List

  include ::TokyoMetro::ClassNameLibrary::Api::TrainLocation

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

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

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

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

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/api/train_location/list.rb