Class: TokyoMetro::Factory::Generate::Api::TrainTimetable::Info

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

Overview

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

Defined Under Namespace

Modules: StationTime

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
30
# 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