Class: TokyoMetro::Factory::Seed::Api::StationTrainTime::TrainInStationTimetable

Inherits:
Object
  • Object
show all
Defined in:
lib/tokyo_metro/factory/seed/api/station_train_time/train_in_station_timetable.rb

Defined Under Namespace

Classes: StationTimetableInfo

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(train, station_timetable_info, operation_day_in_db, train_timetables) ⇒ TrainInStationTimetable

Constructor



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tokyo_metro/factory/seed/api/station_train_time/train_in_station_timetable.rb', line 6

def initialize( train , station_timetable_info , operation_day_in_db , train_timetables )
  @train = train
  @station_timetable_info = station_timetable_info

  class << @train
    include ::TokyoMetro::Refinement::Api::StationTimetable::Info::TrainTime::Info::TerminalStationsSameAs
  end

  @operation_day_in_db = operation_day_in_db
  @train_timetables = train_timetables
end

Instance Attribute Details

#operation_day_in_dbObject (readonly)

Returns the value of attribute operation_day_in_db.



24
25
26
# File 'lib/tokyo_metro/factory/seed/api/station_train_time/train_in_station_timetable.rb', line 24

def operation_day_in_db
  @operation_day_in_db
end

#station_timetable_info::TokyoMetro::Factory::Seed::Api::StationTrainTime::TrainInStationTimetable::StationTimetableInfo (readonly)



22
23
24
# File 'lib/tokyo_metro/factory/seed/api/station_train_time/train_in_station_timetable.rb', line 22

def station_timetable_info
  @station_timetable_info
end

#train::TokyoMetro::Api::StationTimetable::Info::TrainTime::Info (readonly)



19
20
21
# File 'lib/tokyo_metro/factory/seed/api/station_train_time/train_in_station_timetable.rb', line 19

def train
  @train
end

#train_timetablesObject (readonly)

Returns the value of attribute train_timetables.



23
24
25
# File 'lib/tokyo_metro/factory/seed/api/station_train_time/train_in_station_timetable.rb', line 23

def train_timetables
  @train_timetables
end

Class Method Details

.find_and_get_train_timetable_infos_of_this_train(train, station_timetable_info, operation_day_in_db, train_timetables) ⇒ Object



26
27
28
# File 'lib/tokyo_metro/factory/seed/api/station_train_time/train_in_station_timetable.rb', line 26

def self.find_and_get_train_timetable_infos_of_this_train( train , station_timetable_info , operation_day_in_db , train_timetables )
  self.new( train , station_timetable_info , operation_day_in_db , train_timetables ).find_and_get_train_timetable_infos_of_this_train
end

Instance Method Details

#find_and_get_train_timetable_infos_of_this_trainObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/tokyo_metro/factory/seed/api/station_train_time/train_in_station_timetable.rb', line 30

def find_and_get_train_timetable_infos_of_this_train
  @train_timetable_in_api = train_timetable_in_api
  @instance_of_actual_departure_station_info_in_db = instance_of_actual_departure_station_info_in_db

  h = ::Hash.new

  [ :station_timetable_in_db , :train_timetable_in_db , :station_set_in_db ].each do | key_name |
    h[ key_name ] = self.send( key_name )
  end

  h.merge( @train_timetable_in_api.station_time_info_and_index_of( @instance_of_actual_departure_station_info_in_db.same_as ) )
end