class TokyoMetro::Factory::Convert::Customize::Api::StationTimetable::AdditionalInfos::Generate::List
Public Instance Methods
process()
click to toggle source
# File lib/tokyo_metro/factory/convert/customize/api/station_timetable/additional_infos/generate/list.rb, line 12 def process delete_ignored_station_timetables replacing_infos end
Private Instance Methods
delete_ignored_station_timetables()
click to toggle source
# File lib/tokyo_metro/factory/convert/customize/api/station_timetable/additional_infos/generate/list.rb, line 19 def delete_ignored_station_timetables @object.reject! do | item | IGNORED_STATION_TIMETABLES.include?( item.same_as ) end end
replacing_infos()
click to toggle source
# File lib/tokyo_metro/factory/convert/customize/api/station_timetable/additional_infos/generate/list.rb, line 25 def replacing_infos @object.each do | item | replacing_infos_of_this_station_timetable = REPLACING_INFOS[ item.same_as ] if replacing_infos_of_this_station_timetable.present? replacing_name = replacing_infos_of_this_station_timetable[ "replacing_name" ] if replacing_name.present? item.instance_variable_set( :@same_as , replacing_name ) end replacing_fundamental_infos = replacing_infos_of_this_station_timetable[ "replacing_fundamental_infos" ] if replacing_fundamental_infos.present? new_ary_of_fundamental_infos = self.class.fundamental_list_class.new( replacing_fundamental_infos.map { | info | infos_send_to_new_fundamental_info = [ "stations" , "railway_lines" , "operators" , "railway_directions" ].map { | key | info[ key ] } self.class.fundamental_info_class.new( *infos_send_to_new_fundamental_info ) } ) item.instance_variable_set( :@fundamental_infos , new_ary_of_fundamental_infos ) end end end end