Sha256: adb833d1ad6d47c002d28e68ead10ed57456603516ea3bb729e93252c7079885

Contents?: true

Size: 966 Bytes

Versions: 1

Compression:

Stored size: 966 Bytes

Contents

class TokyoMetro::Factory::Convert::Patch::Api::StationTimetable::Origin::Info::TrainTime::Info < TokyoMetro::Factory::Convert::Common::Api::MetaClass::Fundamental::Normal

  # 補足情報に始発駅情報が含まれているにも関わらず「当駅始発」となっている場合に、「当駅始発」の情報を削除する
  def process
    if to_process?
      clear_origin_info
    end
  end

  private

  def clear_origin_info
    @object.instance_variable_set( :@is_origin , false )
  end

  def to_process?
     @object.is_origin and ( has_starting_station_info_of_ayase? or has_starting_station_info_of_wakoshi? )
  end

  [ :ayase , :wakoshi ].each do | station_name |
    eval <<-DEF
      def has_starting_station_info_of_#{ station_name }?
        @object.notes.any? { | info | info.instance_of?( ::TokyoMetro::Api::StationTimetable::Info::TrainTime::Info::Note::StartingStation::#{ station_name.capitalize } ) }
      end
    DEF
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/factory/convert/patch/api/station_timetable/origin/info/train_time/info.rb