class TokyoMetro::Factory::Generate::Api::TrainTimetable::Info
API から取得したハッシュからインスタンスを生成するための Factory Pattern のクラス(メタクラス)
Public Instance Methods
variables()
click to toggle source
Info
クラスに送る変数のリスト @return [::Array]
# File lib/tokyo_metro/factory/generate/api/train_timetable/info.rb, line 8 def variables id_urn = @hash[ "\@id" ] same_as = @hash[ "owl:sameAs" ] dc_date = @hash[ "dc:date" ] train_number = @hash[ "odpt:trainNumber" ] railway_line = @hash[ "odpt:railway" ] train = @hash[ "odpt:train" ] operator = @hash[ "odpt:operator" ] train_type = @hash[ "odpt:trainType" ] railway_direction = @hash[ "odpt:railDirection" ] starting_station = @hash[ "odpt:startingStation" ] terminal_station = @hash[ "odpt:terminalStation" ] train_owner = @hash[ "odpt:trainOwner" ] weekdays = generate_timetable_data_from_hash( "odpt:weekdays" ) saturdays = generate_timetable_data_from_hash( "odpt:saturdays" ) holidays = generate_timetable_data_from_hash( "odpt:holidays" ) [ id_urn , same_as , dc_date , train_number , railway_line , train , operator , train_type , railway_direction , starting_station , terminal_station , train_owner , weekdays , saturdays , holidays ] end
Private Instance Methods
generate_timetable_data_from_hash( key )
click to toggle source
# File lib/tokyo_metro/factory/generate/api/train_timetable/info.rb, line 34 def generate_timetable_data_from_hash( key ) unless @hash[ key ].nil? #puts key #puts @hash.keys.to_s #puts @hash[ "owl:sameAs" ] self.class.station_time_list_class.new( @hash[ key ].map { | train | self.class.station_time_info_class.generate_from_hash( train ) }) else nil end end