Sha256: f024e9e89a1c0e997b6df4cd9d4e3b6d2bb0a26d5e43efe271ad7c735cbe205b

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

class TokyoMetro::Factory::Convert::Customize::Api::TrainTimetable::ReplaceStationName::Info < TokyoMetro::Factory::Convert::Common::Api::MetaClass::Fundamental::Normal

  def initialize( object , regexp_for_replaced_station , replacing_string )
    super( object )
    @regexp_for_replaced_station = regexp_for_replaced_station
    @replacing_string = replacing_string
  end

  def process
    object.valid_timetables.each do | timetable |
      timetable.each do | station_time |

        [ :arrival_station , :departure_station ].each do | method |
          station_name = station_time.send( method )
          if station_name.present? and @regexp_for_replaced_station === station_name
            station_name_new = station_name.gsub( @regexp_for_replaced_station , @replacing_string )
            station_time.instance_variable_set( "@#{ method }" , station_name_new )
          end
        end

      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/factory/convert/customize/api/train_timetable/replace_station_name/info.rb