Module: TokyoMetro::Factory::Seed
- Extended by:
- OdptCommon::CalcTime
- Defined in:
- lib/tokyo_metro/factory/seed.rb
Defined Under Namespace
Modules: Api, Common, Reference, Static
Class Method Details
.destroy_all_items(*db_names) ⇒ Object
Also known as:
destroy_all_items_of
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/tokyo_metro/factory/seed.rb', line 62
def self.destroy_all_items( *db_names )
if db_names.all? { | db_name | db_name.instance_of?( ::String ) or db_name.instance_of?( ::Symbol ) }
db_names = db_names.map( &:to_s )
unless db_names.all? { | db_name | /\A[a-z_]+s/ === db_name }
raise "Error: #{ db_name.to_s } is not valid."
end
db_names = db_names.map { | db_name | eval( "::#{db_name.singularize.camelize}" ) }
end
db_names.each do | db_name |
puts "* Destory all items in \'#{ db_name }\'."
db_name.all.each do | item |
item.destroy
end
end
return nil
end
|
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/tokyo_metro/factory/seed.rb', line 87
def self.destroy_all_items_related_to_barrier_free_facilities
destroy_all_items_of(
::BarrierFreeFacility::Info ,
::BarrierFreeFacilityServiceDetail ,
::BarrierFreeFacilityServiceDetailPattern ,
::BarrierFreeFacilityEscalatorDirection ,
::BarrierFreeFacilityToiletAssistant ,
::BarrierFreeFacilityToiletAssistantPattern
)
end
|
98
99
100
101
102
103
104
105
|
# File 'lib/tokyo_metro/factory/seed.rb', line 98
def self.destroy_all_items_related_to_platform_infos
destroy_all_items_of(
::StationFacilityPlatformInfo ,
::StationFacilityPlatformInfoTransferInfo ,
::StationFacilityPlatformInfoSurroundingArea ,
::StationFacilityPlatformInfoBarrierFreeFacility
)
end
|
107
108
109
110
111
112
|
# File 'lib/tokyo_metro/factory/seed.rb', line 107
def self.destroy_all_items_related_to_station_timetables
destroy_all_items_of(
::StationTimetable ,
::StationTimetableFundamentalInfo
)
end
|
80
81
82
83
84
85
|
# File 'lib/tokyo_metro/factory/seed.rb', line 80
def self.destroy_all_items_related_to_stations
destroy_all_items_of(
::Station::Info ,
::ConnectingRailwayLine::Info
)
end
|
.process ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/tokyo_metro/factory/seed.rb', line 9
def self.process
h = settings_of_seed
time_begin = ::Time.now
inspect_time_begin( time_begin )
process_fundamental_static(h)
process_static_of_railway_lines(h)
process_station_facilities(h)
process_stations(h)
process_static_railway_directions(h)
process_train_types(h)
process_points(h)
process_sub_info_of_railway_lines(h)
process_passenger_surveys(h)
process_barrier_free_infos_of_station_facilities(h)
process_platform_infos_of_station_facilities(h)
process_fares(h)
process_timetables(h)
inspect_time_end( time_begin )
end
|