Sha256: 62bb91d44ead9c0b3b418a85347e98f94615c24d68df63e6127f2756d485d03b

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# API から取得したハッシュからインスタンスを生成するための Factory Pattern のクラス(メタクラス)
class TokyoMetro::Factory::Generate::Api::StationTimetable::Info::TrainTime::Info < TokyoMetro::Factory::Generate::Api::MetaClass::Info::NotOnTheTopLayer

  include ::TokyoMetro::ClassNameLibrary::Api::StationTimetable

  def variables
    departure_time = ::DateTime.convert_str( @hash[ "odpt:departureTime" ] )
    terminal_station = @hash[ "odpt:destinationStation" ]
    train_type = @hash[ "odpt:trainType" ]
    is_last = @hash[ "odpt:isLast" ]
    is_origin = @hash[ "odpt:isOrigin" ]
    car_composition = @hash[ "odpt:carComposition" ]
    unless is_last
      is_last = false
    end
    unless is_origin
      is_origin = false
    end

    # 列車の補足情報のインスタンスを取得
    notes = self.class.train_info_note_list_class.generate_from_string( @hash[ "odpt:note" ] )

    [ departure_time , terminal_station , train_type , is_last , is_origin , car_composition , notes ]
  end

  def self.instance_class
    train_info_class
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/factory/generate/api/station_timetable/info/train_time/info.rb