class TokyoMetro::Factory::Seed::Api::StationTimetable::Info::TrainTime::Info

Public Class Methods

new( *args ) click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 10
def initialize( *args )
  super( *args , get_id: true )
  class << @info
    include ::TokyoMetro::Refinement::Api::StationTimetable::Info::TrainTime::Info::OptionalInfoId
  end
end
train_timetable_update_processor_class() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 17
def self.train_timetable_update_processor_class
  ::TokyoMetro::Factory::Seed::Api::StationTimetable::Info::TrainTime::Info::UpdateTrainTimetable
end

Private Instance Methods

actual_train_type() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 151
def actual_train_type
  if at_namboku_and_toei_mita_line_common_station? and train_timetable_in_db.toei_mita_line?
    if local?
      "odpt.TrainType:Toei.Local"
    elsif express?
      "odpt.TrainType:Toei.Express"
    else
      raise "Error"
    end
  else
    @info.train_type
  end
end
departure_station_info_in_db() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 107
def departure_station_info_in_db
  station_set_in_db[ :departure ]
end
departure_station_same_as() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 125
def departure_station_same_as
  departure_station_info_in_db.same_as
end
hash_to_db() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 32
def hash_to_db
  puts " " * 32 + "Train is same as: " + train_timetable_in_db.same_as
  puts " " * 32 + "Terminal station: " + train_timetable_in_db.terminal_station.same_as
  # puts "Train number: " + train_timetable_in_db.train_number
  # puts ""

  h = ::Hash.new

  h = h.merge( time_infos )

  [ :is_last , :is_origin , :platform_number ].each do | key_name |
    h[ key_name ] = @info.send( key_name )
  end

  [
    :station_timetable_id ,
    :train_timetable_id ,
    :departure_station_info_id ,
    :index_in_train_timetable ,
    :station_timetable_starting_station_info_id ,
    :train_type_in_this_station_info_id ,
    :station_timetable_connection_info_id # 接続情報は station_train_time に対して定義する。(train_timetable_connection_info_id でないことに注意)
  ].each do | key_name |
    h[ key_name ] = self.send( key_name )
  end

  h[ :stop_for_drivers ] = false

  h
end
is_train_type_of?( *variables , compared )
Alias for: train_type_of?
method_name_for_db_instance_class() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 28
def method_name_for_db_instance_class
  :db_instance_class_of_station_train_time
end
railway_line_ids() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 139
def railway_line_ids
  station_timetable_in_db.railway_lines.pluck( :id )
end
seed_optional_infos() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 63
def seed_optional_infos
  update_train_timetable!
  seed_train_relations

  train_time_in_station_timetable_seed_completed!
  station_time_in_train_timetable_seed_completed!
end
seed_train_relations() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 75
def seed_train_relations
  station_time_in_train_timetable.seed_train_relations( @id , train_timetable_id )
end
set_optional_variables( args ) click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 23
def set_optional_variables( args )
  super( args )
  @train_timetable_info = ::TokyoMetro::Factory::Seed::Api::StationTrainTime::TrainInStationTimetable.find_and_get_train_timetable_infos_of_this_train( @info , *optional_variables )
end
station_same_as__is_in?( *variables ) click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 165
def station_same_as__is_in?( *variables )
  super( *variables , departure_station_same_as )
end
station_time_in_train_timetable_seed_completed!() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 83
def station_time_in_train_timetable_seed_completed!
  station_time_in_train_timetable.seed_completed!
end
time_infos() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 103
def time_infos
  station_time_in_train_timetable.time_to_h
end
train_time_in_station_timetable_seed_completed!() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 79
def train_time_in_station_timetable_seed_completed!
  @info.seed_completed!
end
train_type_in_this_station_info_id() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 129
def train_type_in_this_station_info_id
  self.class.factory_for_train_type.id_in_db(
    actual_train_type ,
    train_timetable_in_db.railway_line ,
    train_timetable_in_db.terminal_station ,
    @operation_day_in_db ,
    station_timetable_in_db.stations
  )
end
train_type_of?( *variables , compared ) click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 169
def train_type_of?( *variables , compared )
  super( *variables , @info.train_type )
end
Also aliased as: is_train_type_of?
update_train_timetable!() click to toggle source
# File lib/tokyo_metro/factory/seed/api/station_timetable/info/train_time/info.rb, line 71
def update_train_timetable!
  self.class.train_timetable_update_processor_class.process( @info , station_timetable_in_db , train_timetable_in_db )
end