Class: TokyoMetro::Factory::Generate::Api::StationTimetable::Info

Inherits:
MetaClass::Info::Fundamental show all
Includes:
ClassNameLibrary::Api::StationTimetable
Defined in:
lib/tokyo_metro/factory/generate/api/station_timetable/info.rb

Overview

API から取得したハッシュからインスタンスを生成するための Factory Pattern のクラス(メタクラス)

Defined Under Namespace

Modules: Fundamental, TrainTime

Instance Method Summary collapse

Methods inherited from MetaClass::Info::Fundamental

#generate, #initialize, instance_class, process, #to_check_validity?

Constructor Details

This class inherits a constructor from TokyoMetro::Factory::Generate::Api::MetaClass::Info::Fundamental

Instance Method Details

#variables::Array

Info クラスに送る変数のリスト

Returns:

  • (::Array)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tokyo_metro/factory/generate/api/station_timetable/info.rb', line 8

def variables
  id = @hash[ "\@id" ]
  same_as = @hash[ "owl:sameAs" ]
  dc_date = @hash[ "dc:date" ]

  # station = @hash[ "odpt:station" ]
  # railway_line = @hash[ "odpt:railway" ]
  # operator = @hash[ "odpt:operator" ]
  # railway_direction = @hash[ "odpt:railDirection" ]

  fundamental_infos = station_fundamental_infos

  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 , same_as , dc_date , station , railway_line , operator , railway_direction , 
    # weekdays , saturdays , holidays ]

  [ id , same_as , dc_date , fundamental_infos , 
    weekdays , saturdays , holidays ]
end