Sha256: c1174c1816fe606445cecfc844230d644e502b6469be29d84e99a229e2501ec4

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

class TokyoMetro::Factory::Convert::Common::Api::MetaClass::TrainInfos::ToeiMitaLine::Info < TokyoMetro::Factory::Convert::Common::Api::MetaClass::Fundamental::Normal

  def process
    if toei_mita_line_train_including_on_namboku_line?
      convert_railway_line
      convert_railway_direction
      convert_train_type
    end
  end

  private

  def toei_mita_line_train_including_on_namboku_line?
    object.toei_mita_line_train_including_on_namboku_line?
  end

  def convert_railway_line
    object.instance_variable_set( :@railway_line , "odpt.Railway:Toei.Mita" )
  end

  def convert_railway_direction
    case object.railway_direction
    when "odpt.RailDirection:TokyoMetro.Meguro"
      railway_direction_new = "odpt.RailDirection:Toei.Meguro"
    when "odpt.RailDirection:TokyoMetro.ShirokaneTakanawa"
      railway_direction_new = "odpt.RailDirection:Toei.NishiTakashimadaira"
    end
    object.instance_variable_set( :@railway_direction , railway_direction_new )
  end

  def convert_train_type
    case object.train_type
    when "odpt.TrainType:TokyoMetro.Local"
      train_type_new = "odpt.TrainType:Toei.Local"
    when "odpt.TrainType:TokyoMetro.Express"
      train_type_new = "odpt.TrainType:Toei.Express"
    end
    object.instance_variable_set( :@train_type , train_type_new )
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/factory/convert/common/api/meta_class/train_infos/toei_mita_line/info.rb