tzinfo 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of tzinfo might be problematic. Click here for more details.
- data/CHANGES +222 -172
- data/README +21 -4
- data/Rakefile +27 -12
- data/lib/tzinfo.rb +5 -2
- data/lib/tzinfo/country.rb +100 -90
- data/lib/tzinfo/country_index_definition.rb +50 -0
- data/lib/tzinfo/country_info.rb +82 -0
- data/lib/tzinfo/country_timezone.rb +103 -0
- data/lib/tzinfo/data_timezone.rb +47 -0
- data/lib/tzinfo/data_timezone_info.rb +226 -0
- data/lib/tzinfo/definitions/Africa/Abidjan.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Accra.rb +31 -25
- data/lib/tzinfo/definitions/Africa/Addis_Ababa.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Algiers.rb +53 -44
- data/lib/tzinfo/definitions/Africa/Asmera.rb +20 -13
- data/lib/tzinfo/definitions/Africa/Bamako.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Bangui.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Banjul.rb +20 -13
- data/lib/tzinfo/definitions/Africa/Bissau.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Blantyre.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Brazzaville.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Bujumbura.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Cairo.rb +217 -211
- data/lib/tzinfo/definitions/Africa/Casablanca.rb +36 -29
- data/lib/tzinfo/definitions/Africa/Ceuta.rb +170 -162
- data/lib/tzinfo/definitions/Africa/Conakry.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Dakar.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Dar_es_Salaam.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Djibouti.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Douala.rb +16 -11
- data/lib/tzinfo/definitions/Africa/El_Aaiun.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Freetown.rb +51 -41
- data/lib/tzinfo/definitions/Africa/Gaborone.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Harare.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Johannesburg.rb +23 -16
- data/lib/tzinfo/definitions/Africa/Kampala.rb +21 -14
- data/lib/tzinfo/definitions/Africa/Khartoum.rb +51 -44
- data/lib/tzinfo/definitions/Africa/Kigali.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Kinshasa.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Lagos.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Libreville.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Lome.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Luanda.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Lubumbashi.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Lusaka.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Malabo.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Maputo.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Maseru.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Mbabane.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Mogadishu.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Monrovia.rb +20 -13
- data/lib/tzinfo/definitions/Africa/Nairobi.rb +21 -14
- data/lib/tzinfo/definitions/Africa/Ndjamena.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Niamey.rb +20 -13
- data/lib/tzinfo/definitions/Africa/Nouakchott.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Ouagadougou.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Porto__m__Novo.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Sao_Tome.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Timbuktu.rb +11 -10
- data/lib/tzinfo/definitions/Africa/Tripoli.rb +46 -39
- data/lib/tzinfo/definitions/Africa/Tunis.rb +135 -128
- data/lib/tzinfo/definitions/Africa/Windhoek.rb +138 -128
- data/lib/tzinfo/definitions/America/Adak.rb +194 -181
- data/lib/tzinfo/definitions/America/Anchorage.rb +194 -181
- data/lib/tzinfo/definitions/America/Anguilla.rb +16 -11
- data/lib/tzinfo/definitions/America/Antigua.rb +18 -12
- data/lib/tzinfo/definitions/America/Araguaina.rb +65 -59
- data/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +78 -69
- data/lib/tzinfo/definitions/America/Argentina/Catamarca.rb +81 -71
- data/lib/tzinfo/definitions/America/Argentina/ComodRivadavia.rb +13 -12
- data/lib/tzinfo/definitions/America/Argentina/Cordoba.rb +79 -69
- data/lib/tzinfo/definitions/America/Argentina/Jujuy.rb +80 -69
- data/lib/tzinfo/definitions/America/Argentina/La_Rioja.rb +82 -72
- data/lib/tzinfo/definitions/America/Argentina/Mendoza.rb +82 -71
- data/lib/tzinfo/definitions/America/Argentina/Rio_Gallegos.rb +81 -71
- data/lib/tzinfo/definitions/America/Argentina/San_Juan.rb +82 -72
- data/lib/tzinfo/definitions/America/Argentina/Tucuman.rb +81 -71
- data/lib/tzinfo/definitions/America/Argentina/Ushuaia.rb +81 -71
- data/lib/tzinfo/definitions/America/Aruba.rb +18 -12
- data/lib/tzinfo/definitions/America/Asuncion.rb +172 -164
- data/lib/tzinfo/definitions/America/Atka.rb +11 -10
- data/lib/tzinfo/definitions/America/Bahia.rb +75 -69
- data/lib/tzinfo/definitions/America/Barbados.rb +27 -20
- data/lib/tzinfo/definitions/America/Belem.rb +45 -39
- data/lib/tzinfo/definitions/America/Belize.rb +72 -65
- data/lib/tzinfo/definitions/America/Boa_Vista.rb +49 -43
- data/lib/tzinfo/definitions/America/Bogota.rb +21 -14
- data/lib/tzinfo/definitions/America/Boise.rb +197 -187
- data/lib/tzinfo/definitions/America/Buenos_Aires.rb +11 -10
- data/lib/tzinfo/definitions/America/Cambridge_Bay.rb +175 -163
- data/lib/tzinfo/definitions/America/Campo_Grande.rb +169 -163
- data/lib/tzinfo/definitions/America/Cancun.rb +131 -123
- data/lib/tzinfo/definitions/America/Caracas.rb +20 -13
- data/lib/tzinfo/definitions/America/Catamarca.rb +11 -10
- data/lib/tzinfo/definitions/America/Cayenne.rb +18 -12
- data/lib/tzinfo/definitions/America/Cayman.rb +18 -12
- data/lib/tzinfo/definitions/America/Chicago.rb +281 -272
- data/lib/tzinfo/definitions/America/Chihuahua.rb +134 -126
- data/lib/tzinfo/definitions/America/Coral_Harbour.rb +26 -18
- data/lib/tzinfo/definitions/America/Cordoba.rb +11 -10
- data/lib/tzinfo/definitions/America/Costa_Rica.rb +27 -20
- data/lib/tzinfo/definitions/America/Cuiaba.rb +167 -161
- data/lib/tzinfo/definitions/America/Curacao.rb +18 -12
- data/lib/tzinfo/definitions/America/Danmarkshavn.rb +51 -44
- data/lib/tzinfo/definitions/America/Dawson.rb +174 -163
- data/lib/tzinfo/definitions/America/Dawson_Creek.rb +77 -68
- data/lib/tzinfo/definitions/America/Denver.rb +202 -194
- data/lib/tzinfo/definitions/America/Detroit.rb +184 -175
- data/lib/tzinfo/definitions/America/Dominica.rb +16 -11
- data/lib/tzinfo/definitions/America/Edmonton.rb +198 -190
- data/lib/tzinfo/definitions/America/Eirunepe.rb +47 -41
- data/lib/tzinfo/definitions/America/El_Salvador.rb +21 -15
- data/lib/tzinfo/definitions/America/Ensenada.rb +11 -10
- data/lib/tzinfo/definitions/America/Fort_Wayne.rb +11 -10
- data/lib/tzinfo/definitions/America/Fortaleza.rb +55 -49
- data/lib/tzinfo/definitions/America/Glace_Bay.rb +184 -176
- data/lib/tzinfo/definitions/America/Godthab.rb +159 -153
- data/lib/tzinfo/definitions/America/Goose_Bay.rb +253 -240
- data/lib/tzinfo/definitions/America/Grand_Turk.rb +163 -156
- data/lib/tzinfo/definitions/America/Grenada.rb +16 -11
- data/lib/tzinfo/definitions/America/Guadeloupe.rb +16 -11
- data/lib/tzinfo/definitions/America/Guatemala.rb +25 -19
- data/lib/tzinfo/definitions/America/Guayaquil.rb +18 -12
- data/lib/tzinfo/definitions/America/Guyana.rb +22 -14
- data/lib/tzinfo/definitions/America/Halifax.rb +272 -264
- data/lib/tzinfo/definitions/America/Havana.rb +199 -192
- data/lib/tzinfo/definitions/America/Hermosillo.rb +33 -25
- data/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb +147 -137
- data/lib/tzinfo/definitions/America/Indiana/Knox.rb +201 -192
- data/lib/tzinfo/definitions/America/Indiana/Marengo.rb +151 -141
- data/lib/tzinfo/definitions/America/Indiana/Petersburg.rb +163 -154
- data/lib/tzinfo/definitions/America/Indiana/Vevay.rb +129 -119
- data/lib/tzinfo/definitions/America/Indiana/Vincennes.rb +149 -139
- data/lib/tzinfo/definitions/America/Indianapolis.rb +11 -10
- data/lib/tzinfo/definitions/America/Inuvik.rb +174 -163
- data/lib/tzinfo/definitions/America/Iqaluit.rb +173 -162
- data/lib/tzinfo/definitions/America/Jamaica.rb +39 -32
- data/lib/tzinfo/definitions/America/Jujuy.rb +11 -10
- data/lib/tzinfo/definitions/America/Juneau.rb +192 -180
- data/lib/tzinfo/definitions/America/Kentucky/Louisville.rb +226 -216
- data/lib/tzinfo/definitions/America/Kentucky/Monticello.rb +196 -186
- data/lib/tzinfo/definitions/America/Knox_IN.rb +11 -10
- data/lib/tzinfo/definitions/America/La_Paz.rb +20 -13
- data/lib/tzinfo/definitions/America/Lima.rb +33 -26
- data/lib/tzinfo/definitions/America/Los_Angeles.rb +230 -222
- data/lib/tzinfo/definitions/America/Louisville.rb +11 -10
- data/lib/tzinfo/definitions/America/Maceio.rb +57 -51
- data/lib/tzinfo/definitions/America/Managua.rb +34 -26
- data/lib/tzinfo/definitions/America/Manaus.rb +47 -41
- data/lib/tzinfo/definitions/America/Martinique.rb +21 -14
- data/lib/tzinfo/definitions/America/Mazatlan.rb +137 -129
- data/lib/tzinfo/definitions/America/Mendoza.rb +11 -10
- data/lib/tzinfo/definitions/America/Menominee.rb +188 -179
- data/lib/tzinfo/definitions/America/Merida.rb +130 -123
- data/lib/tzinfo/definitions/America/Mexico_City.rb +142 -134
- data/lib/tzinfo/definitions/America/Miquelon.rb +147 -140
- data/lib/tzinfo/definitions/America/Moncton.rb +252 -243
- data/lib/tzinfo/definitions/America/Monterrey.rb +129 -123
- data/lib/tzinfo/definitions/America/Montevideo.rb +89 -79
- data/lib/tzinfo/definitions/America/Montreal.rb +277 -269
- data/lib/tzinfo/definitions/America/Montserrat.rb +16 -11
- data/lib/tzinfo/definitions/America/Nassau.rb +191 -185
- data/lib/tzinfo/definitions/America/New_York.rb +280 -272
- data/lib/tzinfo/definitions/America/Nipigon.rb +179 -171
- data/lib/tzinfo/definitions/America/Nome.rb +194 -181
- data/lib/tzinfo/definitions/America/Noronha.rb +55 -49
- data/lib/tzinfo/definitions/America/North_Dakota/Center.rb +198 -188
- data/lib/tzinfo/definitions/America/North_Dakota/New_Salem.rb +198 -188
- data/lib/tzinfo/definitions/America/Panama.rb +18 -12
- data/lib/tzinfo/definitions/America/Pangnirtung.rb +175 -162
- data/lib/tzinfo/definitions/America/Paramaribo.rb +24 -15
- data/lib/tzinfo/definitions/America/Phoenix.rb +28 -21
- data/lib/tzinfo/definitions/America/Port__m__au__m__Prince.rb +141 -134
- data/lib/tzinfo/definitions/America/Port_of_Spain.rb +16 -11
- data/lib/tzinfo/definitions/America/Porto_Acre.rb +11 -10
- data/lib/tzinfo/definitions/America/Porto_Velho.rb +45 -39
- data/lib/tzinfo/definitions/America/Puerto_Rico.rb +21 -14
- data/lib/tzinfo/definitions/America/Rainy_River.rb +179 -171
- data/lib/tzinfo/definitions/America/Rankin_Inlet.rb +172 -162
- data/lib/tzinfo/definitions/America/Recife.rb +55 -49
- data/lib/tzinfo/definitions/America/Regina.rb +72 -63
- data/lib/tzinfo/definitions/America/Rio_Branco.rb +45 -39
- data/lib/tzinfo/definitions/America/Rosario.rb +11 -10
- data/lib/tzinfo/definitions/America/Santiago.rb +202 -193
- data/lib/tzinfo/definitions/America/Santo_Domingo.rb +36 -27
- data/lib/tzinfo/definitions/America/Sao_Paulo.rb +169 -163
- data/lib/tzinfo/definitions/America/Scoresbysund.rb +161 -153
- data/lib/tzinfo/definitions/America/Shiprock.rb +11 -10
- data/lib/tzinfo/definitions/America/St_Johns.rb +286 -275
- data/lib/tzinfo/definitions/America/St_Kitts.rb +16 -11
- data/lib/tzinfo/definitions/America/St_Lucia.rb +18 -12
- data/lib/tzinfo/definitions/America/St_Thomas.rb +16 -11
- data/lib/tzinfo/definitions/America/St_Vincent.rb +18 -12
- data/lib/tzinfo/definitions/America/Swift_Current.rb +42 -33
- data/lib/tzinfo/definitions/America/Tegucigalpa.rb +23 -17
- data/lib/tzinfo/definitions/America/Thule.rb +137 -131
- data/lib/tzinfo/definitions/America/Thunder_Bay.rb +184 -175
- data/lib/tzinfo/definitions/America/Tijuana.rb +194 -185
- data/lib/tzinfo/definitions/America/Toronto.rb +277 -269
- data/lib/tzinfo/definitions/America/Tortola.rb +16 -11
- data/lib/tzinfo/definitions/America/Vancouver.rb +234 -226
- data/lib/tzinfo/definitions/America/Virgin.rb +11 -10
- data/lib/tzinfo/definitions/America/Whitehorse.rb +174 -163
- data/lib/tzinfo/definitions/America/Winnipeg.rb +230 -222
- data/lib/tzinfo/definitions/America/Yakutat.rb +191 -180
- data/lib/tzinfo/definitions/America/Yellowknife.rb +171 -162
- data/lib/tzinfo/definitions/Antarctica/Casey.rb +16 -11
- data/lib/tzinfo/definitions/Antarctica/Davis.rb +18 -13
- data/lib/tzinfo/definitions/Antarctica/DumontDUrville.rb +19 -13
- data/lib/tzinfo/definitions/Antarctica/Mawson.rb +16 -11
- data/lib/tzinfo/definitions/Antarctica/McMurdo.rb +169 -163
- data/lib/tzinfo/definitions/Antarctica/Palmer.rb +176 -166
- data/lib/tzinfo/definitions/Antarctica/Rothera.rb +16 -11
- data/lib/tzinfo/definitions/Antarctica/South_Pole.rb +11 -10
- data/lib/tzinfo/definitions/Antarctica/Syowa.rb +16 -11
- data/lib/tzinfo/definitions/Antarctica/Vostok.rb +16 -11
- data/lib/tzinfo/definitions/Arctic/Longyearbyen.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Aden.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Almaty.rb +65 -58
- data/lib/tzinfo/definitions/Asia/Amman.rb +161 -155
- data/lib/tzinfo/definitions/Asia/Anadyr.rb +163 -153
- data/lib/tzinfo/definitions/Asia/Aqtau.rb +73 -60
- data/lib/tzinfo/definitions/Asia/Aqtobe.rb +69 -59
- data/lib/tzinfo/definitions/Asia/Ashgabat.rb +46 -36
- data/lib/tzinfo/definitions/Asia/Ashkhabad.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Baghdad.rb +157 -150
- data/lib/tzinfo/definitions/Asia/Bahrain.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Baku.rb +159 -147
- data/lib/tzinfo/definitions/Asia/Bangkok.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Beirut.rb +183 -177
- data/lib/tzinfo/definitions/Asia/Bishkek.rb +73 -62
- data/lib/tzinfo/definitions/Asia/Brunei.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Calcutta.rb +23 -15
- data/lib/tzinfo/definitions/Asia/Choibalsan.rb +152 -144
- data/lib/tzinfo/definitions/Asia/Chongqing.rb +31 -24
- data/lib/tzinfo/definitions/Asia/Chungking.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Colombo.rb +28 -18
- data/lib/tzinfo/definitions/Asia/Dacca.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Damascus.rb +193 -187
- data/lib/tzinfo/definitions/Asia/Dhaka.rb +25 -16
- data/lib/tzinfo/definitions/Asia/Dili.rb +23 -15
- data/lib/tzinfo/definitions/Asia/Dubai.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Dushanbe.rb +43 -34
- data/lib/tzinfo/definitions/Asia/Gaza.rb +189 -180
- data/lib/tzinfo/definitions/Asia/Harbin.rb +35 -27
- data/lib/tzinfo/definitions/Asia/Hong_Kong.rb +85 -79
- data/lib/tzinfo/definitions/Asia/Hovd.rb +151 -144
- data/lib/tzinfo/definitions/Asia/Irkutsk.rb +163 -154
- data/lib/tzinfo/definitions/Asia/Istanbul.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Jakarta.rb +28 -18
- data/lib/tzinfo/definitions/Asia/Jayapura.rb +19 -13
- data/lib/tzinfo/definitions/Asia/Jerusalem.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Kabul.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Kamchatka.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Karachi.rb +26 -17
- data/lib/tzinfo/definitions/Asia/Kashgar.rb +33 -25
- data/lib/tzinfo/definitions/Asia/Katmandu.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb +29 -18
- data/lib/tzinfo/definitions/Asia/Kuching.rb +38 -29
- data/lib/tzinfo/definitions/Asia/Kuwait.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Macao.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Macau.rb +59 -52
- data/lib/tzinfo/definitions/Asia/Magadan.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Makassar.rb +21 -14
- data/lib/tzinfo/definitions/Asia/Manila.rb +28 -20
- data/lib/tzinfo/definitions/Asia/Muscat.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Nicosia.rb +169 -163
- data/lib/tzinfo/definitions/Asia/Novosibirsk.rb +162 -154
- data/lib/tzinfo/definitions/Asia/Omsk.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Oral.rb +72 -60
- data/lib/tzinfo/definitions/Asia/Phnom_Penh.rb +21 -14
- data/lib/tzinfo/definitions/Asia/Pontianak.rb +28 -18
- data/lib/tzinfo/definitions/Asia/Pyongyang.rb +23 -16
- data/lib/tzinfo/definitions/Asia/Qatar.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Qyzylorda.rb +71 -60
- data/lib/tzinfo/definitions/Asia/Rangoon.rb +22 -14
- data/lib/tzinfo/definitions/Asia/Riyadh.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Riyadh87.rb +590 -346
- data/lib/tzinfo/definitions/Asia/Riyadh88.rb +580 -347
- data/lib/tzinfo/definitions/Asia/Riyadh89.rb +580 -347
- data/lib/tzinfo/definitions/Asia/Saigon.rb +21 -14
- data/lib/tzinfo/definitions/Asia/Sakhalin.rb +164 -154
- data/lib/tzinfo/definitions/Asia/Samarkand.rb +45 -35
- data/lib/tzinfo/definitions/Asia/Seoul.rb +32 -23
- data/lib/tzinfo/definitions/Asia/Shanghai.rb +33 -27
- data/lib/tzinfo/definitions/Asia/Singapore.rb +31 -19
- data/lib/tzinfo/definitions/Asia/Taipei.rb +57 -51
- data/lib/tzinfo/definitions/Asia/Tashkent.rb +45 -35
- data/lib/tzinfo/definitions/Asia/Tbilisi.rb +76 -63
- data/lib/tzinfo/definitions/Asia/Tehran.rb +59 -50
- data/lib/tzinfo/definitions/Asia/Tel_Aviv.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Thimbu.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Thimphu.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Tokyo.rb +28 -21
- data/lib/tzinfo/definitions/Asia/Ujung_Pandang.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb +151 -144
- data/lib/tzinfo/definitions/Asia/Ulan_Bator.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Urumqi.rb +31 -24
- data/lib/tzinfo/definitions/Asia/Vientiane.rb +21 -14
- data/lib/tzinfo/definitions/Asia/Vladivostok.rb +162 -153
- data/lib/tzinfo/definitions/Asia/Yakutsk.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Yekaterinburg.rb +163 -153
- data/lib/tzinfo/definitions/Asia/Yerevan.rb +163 -151
- data/lib/tzinfo/definitions/Atlantic/Azores.rb +268 -257
- data/lib/tzinfo/definitions/Atlantic/Bermuda.rb +171 -165
- data/lib/tzinfo/definitions/Atlantic/Canary.rb +161 -154
- data/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb +21 -14
- data/lib/tzinfo/definitions/Atlantic/Faeroe.rb +157 -151
- data/lib/tzinfo/definitions/Atlantic/Jan_Mayen.rb +11 -10
- data/lib/tzinfo/definitions/Atlantic/Madeira.rb +267 -257
- data/lib/tzinfo/definitions/Atlantic/Reykjavik.rb +83 -75
- data/lib/tzinfo/definitions/Atlantic/South_Georgia.rb +16 -11
- data/lib/tzinfo/definitions/Atlantic/St_Helena.rb +18 -12
- data/lib/tzinfo/definitions/Atlantic/Stanley.rb +168 -159
- data/lib/tzinfo/definitions/Australia/ACT.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Adelaide.rb +185 -178
- data/lib/tzinfo/definitions/Australia/Brisbane.rb +33 -27
- data/lib/tzinfo/definitions/Australia/Broken_Hill.rb +187 -179
- data/lib/tzinfo/definitions/Australia/Canberra.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Currie.rb +183 -177
- data/lib/tzinfo/definitions/Australia/Darwin.rb +27 -20
- data/lib/tzinfo/definitions/Australia/Hobart.rb +191 -185
- data/lib/tzinfo/definitions/Australia/LHI.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Lindeman.rb +37 -31
- data/lib/tzinfo/definitions/Australia/Lord_Howe.rb +158 -150
- data/lib/tzinfo/definitions/Australia/Melbourne.rb +183 -177
- data/lib/tzinfo/definitions/Australia/NSW.rb +11 -10
- data/lib/tzinfo/definitions/Australia/North.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Perth.rb +29 -23
- data/lib/tzinfo/definitions/Australia/Queensland.rb +11 -10
- data/lib/tzinfo/definitions/Australia/South.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Sydney.rb +183 -177
- data/lib/tzinfo/definitions/Australia/Tasmania.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Victoria.rb +11 -10
- data/lib/tzinfo/definitions/Australia/West.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Yancowinna.rb +11 -10
- data/lib/tzinfo/definitions/Brazil/Acre.rb +11 -10
- data/lib/tzinfo/definitions/Brazil/DeNoronha.rb +11 -10
- data/lib/tzinfo/definitions/Brazil/East.rb +11 -10
- data/lib/tzinfo/definitions/Brazil/West.rb +11 -10
- data/lib/tzinfo/definitions/CET.rb +173 -168
- data/lib/tzinfo/definitions/CST6CDT.rb +190 -183
- data/lib/tzinfo/definitions/Canada/Atlantic.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Central.rb +11 -10
- data/lib/tzinfo/definitions/Canada/East__m__Saskatchewan.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Eastern.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Mountain.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Newfoundland.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Pacific.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Saskatchewan.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Yukon.rb +11 -10
- data/lib/tzinfo/definitions/Chile/Continental.rb +11 -10
- data/lib/tzinfo/definitions/Chile/EasterIsland.rb +11 -10
- data/lib/tzinfo/definitions/Cuba.rb +9 -8
- data/lib/tzinfo/definitions/EET.rb +161 -156
- data/lib/tzinfo/definitions/EST.rb +12 -8
- data/lib/tzinfo/definitions/EST5EDT.rb +190 -183
- data/lib/tzinfo/definitions/Egypt.rb +9 -8
- data/lib/tzinfo/definitions/Eire.rb +9 -8
- data/lib/tzinfo/definitions/Etc/GMT.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT0.rb +11 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__0.rb +11 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__1.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__10.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__11.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__12.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__13.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__14.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__2.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__3.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__4.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__5.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__6.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__7.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__8.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__9.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__0.rb +11 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__1.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__10.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__11.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__12.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__2.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__3.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__4.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__5.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__6.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__7.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__8.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__9.rb +14 -10
- data/lib/tzinfo/definitions/Etc/Greenwich.rb +11 -10
- data/lib/tzinfo/definitions/Etc/UCT.rb +14 -10
- data/lib/tzinfo/definitions/Etc/UTC.rb +14 -10
- data/lib/tzinfo/definitions/Etc/Universal.rb +11 -10
- data/lib/tzinfo/definitions/Etc/Zulu.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Amsterdam.rb +226 -216
- data/lib/tzinfo/definitions/Europe/Andorra.rb +151 -144
- data/lib/tzinfo/definitions/Europe/Athens.rb +183 -174
- data/lib/tzinfo/definitions/Europe/Belfast.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Belgrade.rb +161 -155
- data/lib/tzinfo/definitions/Europe/Berlin.rb +186 -179
- data/lib/tzinfo/definitions/Europe/Bratislava.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Brussels.rb +230 -221
- data/lib/tzinfo/definitions/Europe/Bucharest.rb +179 -172
- data/lib/tzinfo/definitions/Europe/Budapest.rb +195 -189
- data/lib/tzinfo/definitions/Europe/Chisinau.rb +187 -175
- data/lib/tzinfo/definitions/Europe/Copenhagen.rb +177 -170
- data/lib/tzinfo/definitions/Europe/Dublin.rb +274 -263
- data/lib/tzinfo/definitions/Europe/Gibraltar.rb +243 -234
- data/lib/tzinfo/definitions/Europe/Helsinki.rb +161 -154
- data/lib/tzinfo/definitions/Europe/Istanbul.rb +216 -207
- data/lib/tzinfo/definitions/Europe/Kaliningrad.rb +179 -167
- data/lib/tzinfo/definitions/Europe/Kiev.rb +166 -155
- data/lib/tzinfo/definitions/Europe/Lisbon.rb +266 -257
- data/lib/tzinfo/definitions/Europe/Ljubljana.rb +11 -10
- data/lib/tzinfo/definitions/Europe/London.rb +286 -277
- data/lib/tzinfo/definitions/Europe/Luxembourg.rb +229 -219
- data/lib/tzinfo/definitions/Europe/Madrid.rb +209 -200
- data/lib/tzinfo/definitions/Europe/Malta.rb +211 -205
- data/lib/tzinfo/definitions/Europe/Mariehamn.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Minsk.rb +168 -157
- data/lib/tzinfo/definitions/Europe/Monaco.rb +231 -221
- data/lib/tzinfo/definitions/Europe/Moscow.rb +179 -166
- data/lib/tzinfo/definitions/Europe/Nicosia.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Oslo.rb +183 -177
- data/lib/tzinfo/definitions/Europe/Paris.rb +230 -220
- data/lib/tzinfo/definitions/Europe/Prague.rb +185 -178
- data/lib/tzinfo/definitions/Europe/Riga.rb +174 -162
- data/lib/tzinfo/definitions/Europe/Rome.rb +213 -206
- data/lib/tzinfo/definitions/Europe/Samara.rb +164 -153
- data/lib/tzinfo/definitions/Europe/San_Marino.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Sarajevo.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Simferopol.rb +168 -157
- data/lib/tzinfo/definitions/Europe/Skopje.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Sofia.rb +171 -162
- data/lib/tzinfo/definitions/Europe/Stockholm.rb +163 -156
- data/lib/tzinfo/definitions/Europe/Tallinn.rb +170 -159
- data/lib/tzinfo/definitions/Europe/Tirane.rb +175 -169
- data/lib/tzinfo/definitions/Europe/Tiraspol.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Uzhgorod.rb +166 -156
- data/lib/tzinfo/definitions/Europe/Vaduz.rb +157 -151
- data/lib/tzinfo/definitions/Europe/Vatican.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Vienna.rb +181 -175
- data/lib/tzinfo/definitions/Europe/Vilnius.rb +168 -156
- data/lib/tzinfo/definitions/Europe/Warsaw.rb +210 -201
- data/lib/tzinfo/definitions/Europe/Zagreb.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Zaporozhye.rb +169 -158
- data/lib/tzinfo/definitions/Europe/Zurich.rb +165 -158
- data/lib/tzinfo/definitions/GB.rb +9 -8
- data/lib/tzinfo/definitions/GB__m__Eire.rb +9 -8
- data/lib/tzinfo/definitions/GMT.rb +9 -8
- data/lib/tzinfo/definitions/GMT0.rb +9 -8
- data/lib/tzinfo/definitions/GMT__m__0.rb +9 -8
- data/lib/tzinfo/definitions/GMT__p__0.rb +9 -8
- data/lib/tzinfo/definitions/Greenwich.rb +9 -8
- data/lib/tzinfo/definitions/HST.rb +12 -8
- data/lib/tzinfo/definitions/Hongkong.rb +9 -8
- data/lib/tzinfo/definitions/Iceland.rb +9 -8
- data/lib/tzinfo/definitions/Indian/Antananarivo.rb +19 -13
- data/lib/tzinfo/definitions/Indian/Chagos.rb +18 -12
- data/lib/tzinfo/definitions/Indian/Christmas.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Cocos.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Comoro.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Kerguelen.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Mahe.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Maldives.rb +18 -12
- data/lib/tzinfo/definitions/Indian/Mauritius.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Mayotte.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Reunion.rb +16 -11
- data/lib/tzinfo/definitions/Iran.rb +9 -8
- data/lib/tzinfo/definitions/Israel.rb +9 -8
- data/lib/tzinfo/definitions/Jamaica.rb +9 -8
- data/lib/tzinfo/definitions/Japan.rb +9 -8
- data/lib/tzinfo/definitions/Kwajalein.rb +9 -8
- data/lib/tzinfo/definitions/Libya.rb +9 -8
- data/lib/tzinfo/definitions/MET.rb +173 -168
- data/lib/tzinfo/definitions/MST.rb +12 -8
- data/lib/tzinfo/definitions/MST7MDT.rb +190 -183
- data/lib/tzinfo/definitions/Mexico/BajaNorte.rb +11 -10
- data/lib/tzinfo/definitions/Mexico/BajaSur.rb +11 -10
- data/lib/tzinfo/definitions/Mexico/General.rb +11 -10
- data/lib/tzinfo/definitions/Mideast/Riyadh87.rb +11 -10
- data/lib/tzinfo/definitions/Mideast/Riyadh88.rb +11 -10
- data/lib/tzinfo/definitions/Mideast/Riyadh89.rb +11 -10
- data/lib/tzinfo/definitions/NZ.rb +9 -8
- data/lib/tzinfo/definitions/NZ__m__CHAT.rb +9 -8
- data/lib/tzinfo/definitions/Navajo.rb +9 -8
- data/lib/tzinfo/definitions/PRC.rb +9 -8
- data/lib/tzinfo/definitions/PST8PDT.rb +190 -183
- data/lib/tzinfo/definitions/Pacific/Apia.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Auckland.rb +200 -190
- data/lib/tzinfo/definitions/Pacific/Chatham.rb +169 -163
- data/lib/tzinfo/definitions/Pacific/Easter.rb +189 -180
- data/lib/tzinfo/definitions/Pacific/Efate.rb +37 -31
- data/lib/tzinfo/definitions/Pacific/Enderbury.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Fakaofo.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Fiji.rb +21 -15
- data/lib/tzinfo/definitions/Pacific/Funafuti.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Galapagos.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Gambier.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Guadalcanal.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Guam.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Honolulu.rb +26 -17
- data/lib/tzinfo/definitions/Pacific/Johnston.rb +14 -10
- data/lib/tzinfo/definitions/Pacific/Kiritimati.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Kosrae.rb +19 -13
- data/lib/tzinfo/definitions/Pacific/Kwajalein.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Majuro.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Marquesas.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Midway.rb +23 -15
- data/lib/tzinfo/definitions/Pacific/Nauru.rb +21 -14
- data/lib/tzinfo/definitions/Pacific/Niue.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Norfolk.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Noumea.rb +23 -17
- data/lib/tzinfo/definitions/Pacific/Pago_Pago.rb +24 -15
- data/lib/tzinfo/definitions/Pacific/Palau.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Pitcairn.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Ponape.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Port_Moresby.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Rarotonga.rb +44 -37
- data/lib/tzinfo/definitions/Pacific/Saipan.rb +22 -14
- data/lib/tzinfo/definitions/Pacific/Samoa.rb +11 -10
- data/lib/tzinfo/definitions/Pacific/Tahiti.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Tarawa.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Tongatapu.rb +25 -18
- data/lib/tzinfo/definitions/Pacific/Truk.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Wake.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Wallis.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Yap.rb +11 -10
- data/lib/tzinfo/definitions/Poland.rb +9 -8
- data/lib/tzinfo/definitions/Portugal.rb +9 -8
- data/lib/tzinfo/definitions/ROC.rb +9 -8
- data/lib/tzinfo/definitions/ROK.rb +9 -8
- data/lib/tzinfo/definitions/Singapore.rb +9 -8
- data/lib/tzinfo/definitions/Turkey.rb +9 -8
- data/lib/tzinfo/definitions/UCT.rb +9 -8
- data/lib/tzinfo/definitions/US/Alaska.rb +11 -10
- data/lib/tzinfo/definitions/US/Aleutian.rb +11 -10
- data/lib/tzinfo/definitions/US/Arizona.rb +11 -10
- data/lib/tzinfo/definitions/US/Central.rb +11 -10
- data/lib/tzinfo/definitions/US/East__m__Indiana.rb +11 -10
- data/lib/tzinfo/definitions/US/Eastern.rb +11 -10
- data/lib/tzinfo/definitions/US/Hawaii.rb +11 -10
- data/lib/tzinfo/definitions/US/Indiana__m__Starke.rb +11 -10
- data/lib/tzinfo/definitions/US/Michigan.rb +11 -10
- data/lib/tzinfo/definitions/US/Mountain.rb +11 -10
- data/lib/tzinfo/definitions/US/Pacific.rb +11 -10
- data/lib/tzinfo/definitions/US/Pacific__m__New.rb +11 -10
- data/lib/tzinfo/definitions/US/Samoa.rb +11 -10
- data/lib/tzinfo/definitions/UTC.rb +9 -8
- data/lib/tzinfo/definitions/Universal.rb +9 -8
- data/lib/tzinfo/definitions/WET.rb +161 -156
- data/lib/tzinfo/definitions/W__m__SU.rb +9 -8
- data/lib/tzinfo/definitions/Zulu.rb +9 -8
- data/lib/tzinfo/indexes/countries.rb +875 -0
- data/lib/tzinfo/indexes/timezones.rb +554 -0
- data/lib/tzinfo/info_timezone.rb +52 -0
- data/lib/tzinfo/linked_timezone.rb +51 -0
- data/lib/tzinfo/linked_timezone_info.rb +44 -0
- data/lib/tzinfo/time_or_datetime.rb +33 -22
- data/lib/tzinfo/timezone.rb +162 -112
- data/lib/tzinfo/timezone_definition.rb +56 -0
- data/lib/tzinfo/timezone_index_definition.rb +72 -0
- data/lib/tzinfo/timezone_info.rb +40 -0
- data/lib/tzinfo/timezone_offset_info.rb +94 -0
- data/lib/tzinfo/timezone_period.rb +110 -53
- data/lib/tzinfo/timezone_proxy.rb +85 -0
- data/lib/tzinfo/timezone_transition_info.rb +127 -0
- data/lib/tzinfo/tzdataparser.rb +261 -203
- data/test/tc_country.rb +63 -38
- data/test/tc_country_index_definition.rb +71 -0
- data/test/tc_country_info.rb +72 -0
- data/test/tc_country_timezone.rb +121 -0
- data/test/tc_data_timezone.rb +69 -0
- data/test/tc_data_timezone_info.rb +282 -0
- data/test/tc_info_timezone.rb +37 -0
- data/test/tc_linked_timezone.rb +97 -0
- data/test/tc_linked_timezone_info.rb +18 -0
- data/test/tc_time_or_datetime.rb +30 -0
- data/test/tc_timezone.rb +536 -319
- data/test/tc_timezone_definition.rb +115 -0
- data/test/tc_timezone_index_definition.rb +75 -0
- data/test/tc_timezone_info.rb +13 -0
- data/test/tc_timezone_offset_info.rb +116 -0
- data/test/tc_timezone_period.rb +298 -78
- data/test/tc_timezone_proxy.rb +23 -13
- data/test/tc_timezone_transition_info.rb +194 -0
- metadata +38 -249
- data/lib/tzinfo/countries/AD.rb +0 -12
- data/lib/tzinfo/countries/AE.rb +0 -12
- data/lib/tzinfo/countries/AF.rb +0 -12
- data/lib/tzinfo/countries/AG.rb +0 -12
- data/lib/tzinfo/countries/AI.rb +0 -12
- data/lib/tzinfo/countries/AL.rb +0 -12
- data/lib/tzinfo/countries/AM.rb +0 -12
- data/lib/tzinfo/countries/AN.rb +0 -12
- data/lib/tzinfo/countries/AO.rb +0 -12
- data/lib/tzinfo/countries/AQ.rb +0 -21
- data/lib/tzinfo/countries/AR.rb +0 -21
- data/lib/tzinfo/countries/AS.rb +0 -12
- data/lib/tzinfo/countries/AT.rb +0 -12
- data/lib/tzinfo/countries/AU.rb +0 -22
- data/lib/tzinfo/countries/AW.rb +0 -12
- data/lib/tzinfo/countries/AX.rb +0 -12
- data/lib/tzinfo/countries/AZ.rb +0 -12
- data/lib/tzinfo/countries/BA.rb +0 -12
- data/lib/tzinfo/countries/BB.rb +0 -12
- data/lib/tzinfo/countries/BD.rb +0 -12
- data/lib/tzinfo/countries/BE.rb +0 -12
- data/lib/tzinfo/countries/BF.rb +0 -12
- data/lib/tzinfo/countries/BG.rb +0 -12
- data/lib/tzinfo/countries/BH.rb +0 -12
- data/lib/tzinfo/countries/BI.rb +0 -12
- data/lib/tzinfo/countries/BJ.rb +0 -12
- data/lib/tzinfo/countries/BM.rb +0 -12
- data/lib/tzinfo/countries/BN.rb +0 -12
- data/lib/tzinfo/countries/BO.rb +0 -12
- data/lib/tzinfo/countries/BR.rb +0 -26
- data/lib/tzinfo/countries/BS.rb +0 -12
- data/lib/tzinfo/countries/BT.rb +0 -12
- data/lib/tzinfo/countries/BV.rb +0 -11
- data/lib/tzinfo/countries/BW.rb +0 -12
- data/lib/tzinfo/countries/BY.rb +0 -12
- data/lib/tzinfo/countries/BZ.rb +0 -12
- data/lib/tzinfo/countries/CA.rb +0 -36
- data/lib/tzinfo/countries/CC.rb +0 -12
- data/lib/tzinfo/countries/CD.rb +0 -13
- data/lib/tzinfo/countries/CF.rb +0 -12
- data/lib/tzinfo/countries/CG.rb +0 -12
- data/lib/tzinfo/countries/CH.rb +0 -12
- data/lib/tzinfo/countries/CI.rb +0 -12
- data/lib/tzinfo/countries/CK.rb +0 -12
- data/lib/tzinfo/countries/CL.rb +0 -13
- data/lib/tzinfo/countries/CM.rb +0 -12
- data/lib/tzinfo/countries/CN.rb +0 -16
- data/lib/tzinfo/countries/CO.rb +0 -12
- data/lib/tzinfo/countries/CR.rb +0 -12
- data/lib/tzinfo/countries/CS.rb +0 -12
- data/lib/tzinfo/countries/CU.rb +0 -12
- data/lib/tzinfo/countries/CV.rb +0 -12
- data/lib/tzinfo/countries/CX.rb +0 -12
- data/lib/tzinfo/countries/CY.rb +0 -12
- data/lib/tzinfo/countries/CZ.rb +0 -12
- data/lib/tzinfo/countries/DE.rb +0 -12
- data/lib/tzinfo/countries/DJ.rb +0 -12
- data/lib/tzinfo/countries/DK.rb +0 -12
- data/lib/tzinfo/countries/DM.rb +0 -12
- data/lib/tzinfo/countries/DO.rb +0 -12
- data/lib/tzinfo/countries/DZ.rb +0 -12
- data/lib/tzinfo/countries/EC.rb +0 -13
- data/lib/tzinfo/countries/EE.rb +0 -12
- data/lib/tzinfo/countries/EG.rb +0 -12
- data/lib/tzinfo/countries/EH.rb +0 -12
- data/lib/tzinfo/countries/ER.rb +0 -12
- data/lib/tzinfo/countries/ES.rb +0 -14
- data/lib/tzinfo/countries/ET.rb +0 -12
- data/lib/tzinfo/countries/FI.rb +0 -12
- data/lib/tzinfo/countries/FJ.rb +0 -12
- data/lib/tzinfo/countries/FK.rb +0 -12
- data/lib/tzinfo/countries/FM.rb +0 -14
- data/lib/tzinfo/countries/FO.rb +0 -12
- data/lib/tzinfo/countries/FR.rb +0 -12
- data/lib/tzinfo/countries/GA.rb +0 -12
- data/lib/tzinfo/countries/GB.rb +0 -12
- data/lib/tzinfo/countries/GD.rb +0 -12
- data/lib/tzinfo/countries/GE.rb +0 -12
- data/lib/tzinfo/countries/GF.rb +0 -12
- data/lib/tzinfo/countries/GH.rb +0 -12
- data/lib/tzinfo/countries/GI.rb +0 -12
- data/lib/tzinfo/countries/GL.rb +0 -15
- data/lib/tzinfo/countries/GM.rb +0 -12
- data/lib/tzinfo/countries/GN.rb +0 -12
- data/lib/tzinfo/countries/GP.rb +0 -12
- data/lib/tzinfo/countries/GQ.rb +0 -12
- data/lib/tzinfo/countries/GR.rb +0 -12
- data/lib/tzinfo/countries/GS.rb +0 -12
- data/lib/tzinfo/countries/GT.rb +0 -12
- data/lib/tzinfo/countries/GU.rb +0 -12
- data/lib/tzinfo/countries/GW.rb +0 -12
- data/lib/tzinfo/countries/GY.rb +0 -12
- data/lib/tzinfo/countries/HK.rb +0 -12
- data/lib/tzinfo/countries/HM.rb +0 -11
- data/lib/tzinfo/countries/HN.rb +0 -12
- data/lib/tzinfo/countries/HR.rb +0 -12
- data/lib/tzinfo/countries/HT.rb +0 -12
- data/lib/tzinfo/countries/HU.rb +0 -12
- data/lib/tzinfo/countries/ID.rb +0 -15
- data/lib/tzinfo/countries/IE.rb +0 -12
- data/lib/tzinfo/countries/IL.rb +0 -12
- data/lib/tzinfo/countries/IN.rb +0 -12
- data/lib/tzinfo/countries/IO.rb +0 -12
- data/lib/tzinfo/countries/IQ.rb +0 -12
- data/lib/tzinfo/countries/IR.rb +0 -12
- data/lib/tzinfo/countries/IS.rb +0 -12
- data/lib/tzinfo/countries/IT.rb +0 -12
- data/lib/tzinfo/countries/Index.rb +0 -253
- data/lib/tzinfo/countries/JM.rb +0 -12
- data/lib/tzinfo/countries/JO.rb +0 -12
- data/lib/tzinfo/countries/JP.rb +0 -12
- data/lib/tzinfo/countries/KE.rb +0 -12
- data/lib/tzinfo/countries/KG.rb +0 -12
- data/lib/tzinfo/countries/KH.rb +0 -12
- data/lib/tzinfo/countries/KI.rb +0 -14
- data/lib/tzinfo/countries/KM.rb +0 -12
- data/lib/tzinfo/countries/KN.rb +0 -12
- data/lib/tzinfo/countries/KP.rb +0 -12
- data/lib/tzinfo/countries/KR.rb +0 -12
- data/lib/tzinfo/countries/KW.rb +0 -12
- data/lib/tzinfo/countries/KY.rb +0 -12
- data/lib/tzinfo/countries/KZ.rb +0 -16
- data/lib/tzinfo/countries/LA.rb +0 -12
- data/lib/tzinfo/countries/LB.rb +0 -12
- data/lib/tzinfo/countries/LC.rb +0 -12
- data/lib/tzinfo/countries/LI.rb +0 -12
- data/lib/tzinfo/countries/LK.rb +0 -12
- data/lib/tzinfo/countries/LR.rb +0 -12
- data/lib/tzinfo/countries/LS.rb +0 -12
- data/lib/tzinfo/countries/LT.rb +0 -12
- data/lib/tzinfo/countries/LU.rb +0 -12
- data/lib/tzinfo/countries/LV.rb +0 -12
- data/lib/tzinfo/countries/LY.rb +0 -12
- data/lib/tzinfo/countries/MA.rb +0 -12
- data/lib/tzinfo/countries/MC.rb +0 -12
- data/lib/tzinfo/countries/MD.rb +0 -12
- data/lib/tzinfo/countries/MG.rb +0 -12
- data/lib/tzinfo/countries/MH.rb +0 -13
- data/lib/tzinfo/countries/MK.rb +0 -12
- data/lib/tzinfo/countries/ML.rb +0 -12
- data/lib/tzinfo/countries/MM.rb +0 -12
- data/lib/tzinfo/countries/MN.rb +0 -14
- data/lib/tzinfo/countries/MO.rb +0 -12
- data/lib/tzinfo/countries/MP.rb +0 -12
- data/lib/tzinfo/countries/MQ.rb +0 -12
- data/lib/tzinfo/countries/MR.rb +0 -12
- data/lib/tzinfo/countries/MS.rb +0 -12
- data/lib/tzinfo/countries/MT.rb +0 -12
- data/lib/tzinfo/countries/MU.rb +0 -12
- data/lib/tzinfo/countries/MV.rb +0 -12
- data/lib/tzinfo/countries/MW.rb +0 -12
- data/lib/tzinfo/countries/MX.rb +0 -19
- data/lib/tzinfo/countries/MY.rb +0 -13
- data/lib/tzinfo/countries/MZ.rb +0 -12
- data/lib/tzinfo/countries/NA.rb +0 -12
- data/lib/tzinfo/countries/NC.rb +0 -12
- data/lib/tzinfo/countries/NE.rb +0 -12
- data/lib/tzinfo/countries/NF.rb +0 -12
- data/lib/tzinfo/countries/NG.rb +0 -12
- data/lib/tzinfo/countries/NI.rb +0 -12
- data/lib/tzinfo/countries/NL.rb +0 -12
- data/lib/tzinfo/countries/NO.rb +0 -12
- data/lib/tzinfo/countries/NP.rb +0 -12
- data/lib/tzinfo/countries/NR.rb +0 -12
- data/lib/tzinfo/countries/NU.rb +0 -12
- data/lib/tzinfo/countries/NZ.rb +0 -13
- data/lib/tzinfo/countries/OM.rb +0 -12
- data/lib/tzinfo/countries/PA.rb +0 -12
- data/lib/tzinfo/countries/PE.rb +0 -12
- data/lib/tzinfo/countries/PF.rb +0 -14
- data/lib/tzinfo/countries/PG.rb +0 -12
- data/lib/tzinfo/countries/PH.rb +0 -12
- data/lib/tzinfo/countries/PK.rb +0 -12
- data/lib/tzinfo/countries/PL.rb +0 -12
- data/lib/tzinfo/countries/PM.rb +0 -12
- data/lib/tzinfo/countries/PN.rb +0 -12
- data/lib/tzinfo/countries/PR.rb +0 -12
- data/lib/tzinfo/countries/PS.rb +0 -12
- data/lib/tzinfo/countries/PT.rb +0 -14
- data/lib/tzinfo/countries/PW.rb +0 -12
- data/lib/tzinfo/countries/PY.rb +0 -12
- data/lib/tzinfo/countries/QA.rb +0 -12
- data/lib/tzinfo/countries/RE.rb +0 -12
- data/lib/tzinfo/countries/RO.rb +0 -12
- data/lib/tzinfo/countries/RU.rb +0 -25
- data/lib/tzinfo/countries/RW.rb +0 -12
- data/lib/tzinfo/countries/SA.rb +0 -12
- data/lib/tzinfo/countries/SB.rb +0 -12
- data/lib/tzinfo/countries/SC.rb +0 -12
- data/lib/tzinfo/countries/SD.rb +0 -12
- data/lib/tzinfo/countries/SE.rb +0 -12
- data/lib/tzinfo/countries/SG.rb +0 -12
- data/lib/tzinfo/countries/SH.rb +0 -12
- data/lib/tzinfo/countries/SI.rb +0 -12
- data/lib/tzinfo/countries/SJ.rb +0 -13
- data/lib/tzinfo/countries/SK.rb +0 -12
- data/lib/tzinfo/countries/SL.rb +0 -12
- data/lib/tzinfo/countries/SM.rb +0 -12
- data/lib/tzinfo/countries/SN.rb +0 -12
- data/lib/tzinfo/countries/SO.rb +0 -12
- data/lib/tzinfo/countries/SR.rb +0 -12
- data/lib/tzinfo/countries/ST.rb +0 -12
- data/lib/tzinfo/countries/SV.rb +0 -12
- data/lib/tzinfo/countries/SY.rb +0 -12
- data/lib/tzinfo/countries/SZ.rb +0 -12
- data/lib/tzinfo/countries/TC.rb +0 -12
- data/lib/tzinfo/countries/TD.rb +0 -12
- data/lib/tzinfo/countries/TF.rb +0 -12
- data/lib/tzinfo/countries/TG.rb +0 -12
- data/lib/tzinfo/countries/TH.rb +0 -12
- data/lib/tzinfo/countries/TJ.rb +0 -12
- data/lib/tzinfo/countries/TK.rb +0 -12
- data/lib/tzinfo/countries/TL.rb +0 -12
- data/lib/tzinfo/countries/TM.rb +0 -12
- data/lib/tzinfo/countries/TN.rb +0 -12
- data/lib/tzinfo/countries/TO.rb +0 -12
- data/lib/tzinfo/countries/TR.rb +0 -12
- data/lib/tzinfo/countries/TT.rb +0 -12
- data/lib/tzinfo/countries/TV.rb +0 -12
- data/lib/tzinfo/countries/TW.rb +0 -12
- data/lib/tzinfo/countries/TZ.rb +0 -12
- data/lib/tzinfo/countries/UA.rb +0 -15
- data/lib/tzinfo/countries/UG.rb +0 -12
- data/lib/tzinfo/countries/UM.rb +0 -14
- data/lib/tzinfo/countries/US.rb +0 -36
- data/lib/tzinfo/countries/UY.rb +0 -12
- data/lib/tzinfo/countries/UZ.rb +0 -13
- data/lib/tzinfo/countries/VA.rb +0 -12
- data/lib/tzinfo/countries/VC.rb +0 -12
- data/lib/tzinfo/countries/VE.rb +0 -12
- data/lib/tzinfo/countries/VG.rb +0 -12
- data/lib/tzinfo/countries/VI.rb +0 -12
- data/lib/tzinfo/countries/VN.rb +0 -12
- data/lib/tzinfo/countries/VU.rb +0 -12
- data/lib/tzinfo/countries/WF.rb +0 -12
- data/lib/tzinfo/countries/WS.rb +0 -12
- data/lib/tzinfo/countries/YE.rb +0 -12
- data/lib/tzinfo/countries/YT.rb +0 -12
- data/lib/tzinfo/countries/ZA.rb +0 -12
- data/lib/tzinfo/countries/ZM.rb +0 -12
- data/lib/tzinfo/countries/ZW.rb +0 -12
- data/lib/tzinfo/timezone_period_list.rb +0 -234
- data/test/tc_timezone_period_list.rb +0 -310
@@ -0,0 +1,85 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2005-2006 Philip Ross
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#++
|
22
|
+
|
23
|
+
require 'tzinfo/timezone'
|
24
|
+
|
25
|
+
module TZInfo
|
26
|
+
|
27
|
+
# A proxy class representing a timezone with a given identifier. TimezoneProxy
|
28
|
+
# inherits from Timezone and can be treated like any Timezone loaded with
|
29
|
+
# Timezone.get.
|
30
|
+
#
|
31
|
+
# The first time an attempt is made to access the data for the timezone, the
|
32
|
+
# real Timezone is loaded. If the proxy's identifier was not valid, then an
|
33
|
+
# exception will be raised at this point.
|
34
|
+
class TimezoneProxy < Timezone
|
35
|
+
# Construct a new TimezoneProxy for the given identifier. The identifier
|
36
|
+
# is not checked when constructing the proxy. It will be validated on the
|
37
|
+
# when the real Timezone is loaded.
|
38
|
+
def self.new(identifier)
|
39
|
+
# Need to override new to undo the behaviour introduced in Timezone#new.
|
40
|
+
tzp = super()
|
41
|
+
tzp.send(:setup, identifier)
|
42
|
+
tzp
|
43
|
+
end
|
44
|
+
|
45
|
+
# The identifier of the timezone, e.g. "Europe/Paris".
|
46
|
+
def identifier
|
47
|
+
@real_timezone ? @real_timezone.identifier : @identifier
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns the TimezonePeriod for the given UTC time. utc can either be
|
51
|
+
# a DateTime, Time or integer timestamp (Time.to_i). Any timezone
|
52
|
+
# information in utc is ignored (it is treated as a UTC time).
|
53
|
+
def period_for_utc(utc)
|
54
|
+
real_timezone.period_for_utc(utc)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Returns the set of TimezonePeriod instances that are valid for the given
|
58
|
+
# local time as an array. If you just want a single period, use
|
59
|
+
# period_for_local instead and specify how abiguities should be resolved.
|
60
|
+
# Returns an empty array if no periods are found for the given time.
|
61
|
+
def periods_for_local(local)
|
62
|
+
real_timezone.periods_for_local(local)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Dumps this TimezoneProxy for marshalling.
|
66
|
+
def _dump(limit)
|
67
|
+
identifier
|
68
|
+
end
|
69
|
+
|
70
|
+
# Loads a marshalled TimezoneProxy.
|
71
|
+
def self._load(data)
|
72
|
+
TimezoneProxy.new(data)
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
def setup(identifier)
|
77
|
+
@identifier = identifier
|
78
|
+
@real_timezone = nil
|
79
|
+
end
|
80
|
+
|
81
|
+
def real_timezone
|
82
|
+
@real_timezone ||= Timezone.get(@identifier)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2006 Philip Ross
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#++
|
22
|
+
|
23
|
+
require 'date'
|
24
|
+
require 'tzinfo/time_or_datetime'
|
25
|
+
|
26
|
+
module TZInfo
|
27
|
+
# Represents an offset defined in a Timezone data file.
|
28
|
+
class TimezoneTransitionInfo #:nodoc:
|
29
|
+
# The offset this transition changes to (a TimezoneOffsetInfo instance).
|
30
|
+
attr_reader :offset
|
31
|
+
|
32
|
+
# The offset this transition changes from (a TimezoneOffsetInfo instance).
|
33
|
+
attr_reader :previous_offset
|
34
|
+
|
35
|
+
# The numerator of the DateTime if the transition time is defined as a
|
36
|
+
# DateTime, otherwise the transition time as a timestamp.
|
37
|
+
attr_reader :numerator_or_time
|
38
|
+
protected :numerator_or_time
|
39
|
+
|
40
|
+
# Either the denominotor of the DateTime if the transition time is defined
|
41
|
+
# as a DateTime, otherwise nil.
|
42
|
+
attr_reader :denominator
|
43
|
+
protected :denominator
|
44
|
+
|
45
|
+
# Creates a new TimezoneTransitionInfo with the given offset,
|
46
|
+
# previous_offset (both TimezoneOffsetInfo instances) and UTC time.
|
47
|
+
# if denominator is nil, numerator_or_time is treated as a number of
|
48
|
+
# seconds since the epoch. If denominator is specified numerator_or_time
|
49
|
+
# and denominator are used to create a DateTime as follows:
|
50
|
+
#
|
51
|
+
# DateTime.new0(Rational.new!(numerator_or_time, denominator), 0, Date::ITALY)
|
52
|
+
#
|
53
|
+
# For performance reasons, the numerator and denominator must be specified
|
54
|
+
# in their lowest form.
|
55
|
+
def initialize(offset, previous_offset, numerator_or_time, denominator = nil)
|
56
|
+
@offset = offset
|
57
|
+
@previous_offset = previous_offset
|
58
|
+
@numerator_or_time = numerator_or_time
|
59
|
+
@denominator = denominator
|
60
|
+
|
61
|
+
@at = nil
|
62
|
+
@local_end = nil
|
63
|
+
@local_start = nil
|
64
|
+
end
|
65
|
+
|
66
|
+
# A TimeOrDateTime instance representing the UTC time when this transition
|
67
|
+
# occurs.
|
68
|
+
def at
|
69
|
+
unless @at
|
70
|
+
unless @denominator
|
71
|
+
@at = TimeOrDateTime.new(@numerator_or_time)
|
72
|
+
else
|
73
|
+
@at = TimeOrDateTime.new(DateTime.new0(Rational.new!(@numerator_or_time, @denominator), 0, Date::ITALY))
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
@at
|
78
|
+
end
|
79
|
+
|
80
|
+
# A TimeOrDateTime instance representing the local time when this transition
|
81
|
+
# causes the previous observance to end (calculated from at using
|
82
|
+
# previous_offset).
|
83
|
+
def local_end
|
84
|
+
@local_end = at.add_with_convert(@previous_offset.utc_total_offset) unless @local_end
|
85
|
+
@local_end
|
86
|
+
end
|
87
|
+
|
88
|
+
# A TimeOrDateTime instance representing the local time when this transition
|
89
|
+
# causes the next observance to start (calculated from at using offset).
|
90
|
+
def local_start
|
91
|
+
@local_start = at.add_with_convert(@offset.utc_total_offset) unless @local_start
|
92
|
+
@local_start
|
93
|
+
end
|
94
|
+
|
95
|
+
# Returns true if this TimezoneTransitionInfo is equal to the given
|
96
|
+
# TimezoneTransitionInfo. Two TimezoneTransitionInfo instances are
|
97
|
+
# considered to be equal by == if offset, previous_offset and at are all
|
98
|
+
# equal.
|
99
|
+
def ==(tti)
|
100
|
+
tti.respond_to?(:offset) && tti.respond_to?(:previous_offset) && tti.respond_to?(:at) &&
|
101
|
+
offset == tti.offset && previous_offset == tti.previous_offset && at == tti.at
|
102
|
+
end
|
103
|
+
|
104
|
+
# Returns true if this TimezoneTransitionInfo is equal to the given
|
105
|
+
# TimezoneTransitionInfo. Two TimezoneTransitionInfo instances are
|
106
|
+
# considered to be equal by eql? if offset, previous_offset,
|
107
|
+
# numerator_or_time and denominator are all equal. This is stronger than ==,
|
108
|
+
# which just requires the at times to be equal regardless of how they were
|
109
|
+
# originally specified.
|
110
|
+
def eql?(tti)
|
111
|
+
tti.respond_to?(:offset) && tti.respond_to?(:previous_offset) &&
|
112
|
+
tti.respond_to?(:numerator_or_time) && tti.respond_to?(:denominator) &&
|
113
|
+
offset == tti.offset && previous_offset == tti.previous_offset &&
|
114
|
+
numerator_or_time == tti.numerator_or_time && denominator == tti.denominator
|
115
|
+
end
|
116
|
+
|
117
|
+
# Returns a hash of this TimezoneTransitionInfo instance.
|
118
|
+
def hash
|
119
|
+
@offset.hash ^ @previous_offset.hash ^ @numerator_or_time.hash ^ @denominator.hash
|
120
|
+
end
|
121
|
+
|
122
|
+
# Returns internal object state as a programmer-readable string.
|
123
|
+
def inspect
|
124
|
+
"#<#{self.class}: #{at.inspect},#{@offset.inspect}>"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
data/lib/tzinfo/tzdataparser.rb
CHANGED
@@ -26,12 +26,10 @@ require 'fileutils'
|
|
26
26
|
module TZInfo
|
27
27
|
|
28
28
|
# Parses tzdata from ftp://elsie.nci.nih.gov/pub/ and transforms it into
|
29
|
-
# a set of Ruby
|
29
|
+
# a set of Ruby modules that can be used through Timezone and Country.
|
30
30
|
#
|
31
|
-
# Normally, this class wouldn't be used. It is only run to
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# This process is extremely slow (optimization is required).
|
31
|
+
# Normally, this class wouldn't be used. It is only run to update the
|
32
|
+
# timezone data and index modules.
|
35
33
|
class TZDataParser
|
36
34
|
# Minimum year that will be considered.
|
37
35
|
MIN_YEAR = 1800
|
@@ -50,25 +48,14 @@ module TZInfo
|
|
50
48
|
# Limit the set of zones to generate (set to an array containing zone
|
51
49
|
# identifiers).
|
52
50
|
attr_accessor :only_zones
|
53
|
-
|
54
|
-
# Limit the set of countries to generate (set to an array containing
|
55
|
-
# country codes).
|
56
|
-
attr_accessor :only_countries
|
57
|
-
|
51
|
+
|
58
52
|
# Zones to exclude from generation when not using only_zones (set to an
|
59
|
-
# array containing zone identifiers).
|
60
|
-
|
61
|
-
# ['Asia/Riyadh87', 'Asia/Riyadh88', 'Asia/Riyadh89',
|
62
|
-
# 'Mideast/Riyadh87', 'Mideast/Riyadh88', 'Mideast/Ruyadh89']
|
63
|
-
attr_accessor :exclude_zones
|
64
|
-
|
65
|
-
# Countries to exclude from generation when not using only_countries (set
|
66
|
-
# to an array containing country codes).
|
67
|
-
attr_accessor :exclude_countries
|
53
|
+
# array containing zone identifiers).
|
54
|
+
attr_accessor :exclude_zones
|
68
55
|
|
69
56
|
# Initializes a new TZDataParser. input_dir must contain the extracted
|
70
|
-
# tzdata tarball. output_dir is the location to output the
|
71
|
-
# (in
|
57
|
+
# tzdata tarball. output_dir is the location to output the modules
|
58
|
+
# (in definitions and indexes directories).
|
72
59
|
def initialize(input_dir, output_dir)
|
73
60
|
super()
|
74
61
|
@input_dir = input_dir
|
@@ -79,10 +66,8 @@ module TZInfo
|
|
79
66
|
@no_rules = TZDataNoRules.new
|
80
67
|
@generate_zones = true
|
81
68
|
@generate_countries = true
|
82
|
-
@only_zones = []
|
83
|
-
@
|
84
|
-
@exclude_zones = []
|
85
|
-
@exclude_countries = []
|
69
|
+
@only_zones = []
|
70
|
+
@exclude_zones = []
|
86
71
|
end
|
87
72
|
|
88
73
|
# Reads the tzdata source and generates the classes. Takes a long time
|
@@ -103,24 +88,23 @@ module TZInfo
|
|
103
88
|
load_countries
|
104
89
|
|
105
90
|
if @generate_zones
|
91
|
+
modules = []
|
92
|
+
|
106
93
|
if @only_zones.nil? || @only_zones.empty?
|
107
94
|
@zones.each_value {|zone|
|
108
|
-
zone.
|
95
|
+
zone.write_module(@output_dir) unless @exclude_zones.include?(zone.name)
|
109
96
|
}
|
110
97
|
else
|
111
|
-
@only_zones.each {|id|
|
98
|
+
@only_zones.each {|id|
|
99
|
+
zone = @zones[id]
|
100
|
+
zone.write_module(@output_dir)
|
101
|
+
}
|
112
102
|
end
|
103
|
+
|
104
|
+
write_timezones_index
|
113
105
|
end
|
114
106
|
|
115
|
-
if @generate_countries
|
116
|
-
if @only_countries.nil? || @only_countries.empty?
|
117
|
-
@countries.each_value {|country|
|
118
|
-
country.write_class(@output_dir) unless @exclude_countries.include?(country.code)
|
119
|
-
}
|
120
|
-
else
|
121
|
-
@only_countries.each {|code| @countries[code].write_class(@output_dir) }
|
122
|
-
end
|
123
|
-
|
107
|
+
if @generate_countries
|
124
108
|
write_countries_index
|
125
109
|
end
|
126
110
|
end
|
@@ -177,6 +161,12 @@ module TZInfo
|
|
177
161
|
seconds
|
178
162
|
end
|
179
163
|
|
164
|
+
# Encloses the string in single quotes and escapes any single quotes in
|
165
|
+
# the content.
|
166
|
+
def self.quote_str(str)
|
167
|
+
"'#{str.gsub('\'', '\\\\\'')}'"
|
168
|
+
end
|
169
|
+
|
180
170
|
private
|
181
171
|
# Loads all the Rule definitions from the tz data and stores them in
|
182
172
|
# @rule_sets.
|
@@ -270,69 +260,88 @@ module TZInfo
|
|
270
260
|
def load_countries
|
271
261
|
puts 'load_countries'
|
272
262
|
|
273
|
-
IO.foreach(@input_dir + File::SEPARATOR + 'iso3166.tab') {|line|
|
274
|
-
line
|
275
|
-
line = line.gsub(/\s+$/, '')
|
276
|
-
|
277
|
-
if line =~ /^([A-Z]{2})\s+(.*)$/
|
263
|
+
IO.foreach(@input_dir + File::SEPARATOR + 'iso3166.tab') {|line|
|
264
|
+
if line =~ /^([A-Z]{2})\t(.*)$/
|
278
265
|
code = $1
|
279
|
-
name = $2
|
266
|
+
name = $2
|
280
267
|
@countries[code] = TZDataCountry.new(code, name)
|
281
268
|
end
|
282
269
|
}
|
283
270
|
|
284
|
-
IO.foreach(@input_dir + File::SEPARATOR + 'zone.tab') {|line|
|
285
|
-
line
|
286
|
-
|
287
|
-
|
288
|
-
if line =~ /^([A-Z]{2})\s+([^\s]+)\s+([^\s]+)(\s+(.*))?$/
|
271
|
+
IO.foreach(@input_dir + File::SEPARATOR + 'zone.tab') {|line|
|
272
|
+
line.chomp!
|
273
|
+
|
274
|
+
if line =~ /^([A-Z]{2})\t([^\t]+)\t([^\t]+)(\t(.*))?$/
|
289
275
|
code = $1
|
290
|
-
|
291
|
-
|
276
|
+
location_str = $2
|
277
|
+
zone_name = $3
|
278
|
+
description = $5
|
279
|
+
|
292
280
|
country = @countries[code]
|
293
281
|
raise "Country not found: #{code}" if country.nil?
|
294
282
|
|
283
|
+
location = TZDataLocation.new(location_str)
|
284
|
+
|
295
285
|
zone = @zones[zone_name]
|
296
286
|
raise "Zone not found: #{zone_name}" if zone.nil?
|
297
287
|
|
298
|
-
|
288
|
+
description = nil if description == ''
|
289
|
+
|
290
|
+
country.add_zone(TZDataCountryTimezone.new(zone, description, location))
|
299
291
|
end
|
300
292
|
}
|
301
293
|
end
|
302
294
|
|
303
295
|
# Writes a country index file.
|
304
296
|
def write_countries_index
|
305
|
-
dir = @output_dir + File::SEPARATOR + '
|
297
|
+
dir = @output_dir + File::SEPARATOR + 'indexes'
|
306
298
|
FileUtils.mkdir_p(dir)
|
307
299
|
|
308
|
-
File.open(dir + File::SEPARATOR + '
|
309
|
-
file.
|
300
|
+
File.open(dir + File::SEPARATOR + 'countries.rb', 'w') {|file|
|
301
|
+
file.binmode
|
302
|
+
|
303
|
+
file.puts('require \'tzinfo/country_index_definition\'')
|
304
|
+
file.puts('')
|
310
305
|
file.puts('module TZInfo')
|
311
|
-
file.puts('module
|
312
|
-
|
313
|
-
file.puts('
|
314
|
-
|
315
|
-
file.puts('@@all_codes = [')
|
306
|
+
file.puts(' module Indexes')
|
307
|
+
file.puts(' module Countries')
|
308
|
+
file.puts(' include CountryIndexDefinition')
|
309
|
+
file.puts('')
|
316
310
|
|
317
|
-
@countries.
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
file.puts('
|
322
|
-
file.puts('
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
311
|
+
countries = @countries.values.sort {|c1,c2| c1.code <=> c2.code}
|
312
|
+
countries.each {|country| country.write_index_record(file)}
|
313
|
+
|
314
|
+
file.puts(' end') # end module Countries
|
315
|
+
file.puts(' end') # end module Indexes
|
316
|
+
file.puts('end') # end module TZInfo
|
317
|
+
}
|
318
|
+
end
|
319
|
+
|
320
|
+
# Writes a timezone index file.
|
321
|
+
def write_timezones_index
|
322
|
+
dir = File.join(@output_dir, 'indexes')
|
323
|
+
FileUtils.mkdir_p(dir)
|
324
|
+
|
325
|
+
File.open(File.join(dir, 'timezones.rb'), 'w') do |file|
|
326
|
+
file.binmode
|
327
327
|
|
328
|
-
file.puts('
|
328
|
+
file.puts('require \'tzinfo/timezone_index_definition\'')
|
329
|
+
file.puts('')
|
330
|
+
file.puts('module TZInfo')
|
331
|
+
file.puts(' module Indexes')
|
332
|
+
file.puts(' module Timezones')
|
333
|
+
file.puts(' include TimezoneIndexDefinition')
|
334
|
+
file.puts('')
|
329
335
|
|
336
|
+
zones = @zones.values.sort {|t1,t2| t1.name <=> t2.name}
|
337
|
+
zones.each {|zone| zone.write_index_record(file)}
|
330
338
|
|
331
|
-
file.puts('end') # end module
|
339
|
+
file.puts(' end') # end module Timezones
|
340
|
+
file.puts(' end') # end module Indexes
|
332
341
|
file.puts('end') # end module TZInfo
|
333
|
-
|
342
|
+
end
|
343
|
+
|
334
344
|
end
|
335
|
-
|
336
345
|
end
|
337
346
|
|
338
347
|
# Base class for all rule sets.
|
@@ -473,50 +482,67 @@ module TZInfo
|
|
473
482
|
# Base class for Zones and Links.
|
474
483
|
class TZDataDefinition #:nodoc:
|
475
484
|
attr_reader :name
|
476
|
-
attr_reader :
|
485
|
+
attr_reader :name_elements
|
486
|
+
attr_reader :path_elements
|
477
487
|
|
478
488
|
def initialize(name)
|
479
489
|
@name = name
|
480
490
|
|
481
491
|
# + and - aren't allowed in class names
|
482
|
-
@
|
492
|
+
@name_elements = name.gsub(/-/, '__m__').gsub(/\+/, '__p__').split(/\//)
|
493
|
+
@path_elements = @name_elements.clone
|
494
|
+
@path_elements.pop
|
483
495
|
end
|
484
496
|
|
485
497
|
# Creates necessary directories, the file, writes the class header and footer
|
486
498
|
# and yields to a block to write the content.
|
487
|
-
def create_file(output_dir)
|
488
|
-
|
489
|
-
class_name = modules.pop
|
490
|
-
dir = output_dir + File::SEPARATOR + 'definitions' + File::SEPARATOR + modules.join(File::SEPARATOR)
|
499
|
+
def create_file(output_dir)
|
500
|
+
dir = output_dir + File::SEPARATOR + 'definitions' + File::SEPARATOR + @path_elements.join(File::SEPARATOR)
|
491
501
|
FileUtils.mkdir_p(dir)
|
492
502
|
|
493
|
-
File.open(output_dir + File::SEPARATOR + 'definitions' + File::SEPARATOR + @
|
503
|
+
File.open(output_dir + File::SEPARATOR + 'definitions' + File::SEPARATOR + @name_elements.join(File::SEPARATOR) + '.rb', 'w') {|file|
|
494
504
|
file.binmode
|
495
|
-
|
505
|
+
|
506
|
+
def file.indent(by)
|
507
|
+
if @tz_indent
|
508
|
+
@tz_indent += by
|
509
|
+
else
|
510
|
+
@tz_indent = by
|
511
|
+
end
|
512
|
+
end
|
513
|
+
|
514
|
+
def file.puts(s)
|
515
|
+
super("#{' ' * (@tz_indent || 0)}#{s}")
|
516
|
+
end
|
517
|
+
|
518
|
+
file.puts('require \'tzinfo/timezone_definition\'')
|
519
|
+
file.puts('')
|
520
|
+
|
496
521
|
file.puts('module TZInfo')
|
497
|
-
file.
|
498
|
-
|
499
|
-
|
522
|
+
file.indent(2)
|
523
|
+
file.puts('module Definitions')
|
524
|
+
file.indent(2)
|
525
|
+
|
526
|
+
@name_elements.each do |part|
|
527
|
+
file.puts("module #{part}")
|
528
|
+
file.indent(2)
|
500
529
|
end
|
501
530
|
|
502
|
-
file.puts(
|
503
|
-
|
504
|
-
yield file
|
505
|
-
|
506
|
-
file.puts('end') # end class
|
531
|
+
file.puts('include TimezoneDefinition')
|
532
|
+
file.puts('')
|
507
533
|
|
508
|
-
|
509
|
-
|
534
|
+
yield file
|
535
|
+
|
536
|
+
@name_elements.each do
|
537
|
+
file.indent(-2)
|
538
|
+
file.puts('end')
|
510
539
|
end
|
540
|
+
file.indent(-2)
|
511
541
|
file.puts('end') # end module Definitions
|
542
|
+
file.indent(-2)
|
512
543
|
file.puts('end') # end module TZInfo
|
513
544
|
}
|
514
|
-
end
|
515
|
-
|
516
|
-
# Called to write any requires into the file. Called by create_file.
|
517
|
-
def write_requires(file)
|
518
|
-
file.puts('require \'tzinfo/timezone\'')
|
519
|
-
end
|
545
|
+
end
|
520
546
|
end
|
521
547
|
|
522
548
|
# A tz data Link.
|
@@ -527,27 +553,20 @@ module TZInfo
|
|
527
553
|
super(name)
|
528
554
|
@link_to = link_to
|
529
555
|
end
|
530
|
-
|
531
|
-
#
|
532
|
-
def
|
533
|
-
super
|
534
|
-
file.puts("require 'tzinfo/definitions/#{link_to.name_for_class}'")
|
535
|
-
end
|
536
|
-
|
537
|
-
# Superclass of this class (the class we are linking to).
|
538
|
-
def superclass
|
539
|
-
'Definitions::' + link_to.name_for_class.gsub(/\//, '::')
|
540
|
-
end
|
541
|
-
|
542
|
-
# Writes a class for this link.
|
543
|
-
def write_class(output_dir)
|
556
|
+
|
557
|
+
# Writes a module for this link.
|
558
|
+
def write_module(output_dir)
|
544
559
|
puts "writing link #{name}"
|
545
|
-
|
560
|
+
|
546
561
|
create_file(output_dir) {|file|
|
547
|
-
file.puts(
|
548
|
-
file.puts("set_identifier('#{@name.gsub(/'/, '\\\'')}')")
|
562
|
+
file.puts("linked_timezone #{TZDataParser.quote_str(@name)}, #{TZDataParser.quote_str(@link_to.name)}")
|
549
563
|
}
|
550
564
|
end
|
565
|
+
|
566
|
+
# Writes an index record for this link.
|
567
|
+
def write_index_record(file)
|
568
|
+
file.puts(" linked_timezone #{TZDataParser.quote_str(@name)}")
|
569
|
+
end
|
551
570
|
end
|
552
571
|
|
553
572
|
# A tz data Zone. Each line from the tz data is loaded as a TZDataObservance.
|
@@ -561,28 +580,31 @@ module TZInfo
|
|
561
580
|
|
562
581
|
def add_observance(observance)
|
563
582
|
@observances << observance
|
564
|
-
end
|
583
|
+
end
|
565
584
|
|
566
|
-
#
|
567
|
-
def superclass
|
568
|
-
'Timezone'
|
569
|
-
end
|
570
|
-
|
571
|
-
# Writes the class for the zone. Iterates all the periods and asks them
|
585
|
+
# Writes the module for the zone. Iterates all the periods and asks them
|
572
586
|
# to write all periods in the timezone.
|
573
|
-
def
|
587
|
+
def write_module(output_dir)
|
574
588
|
puts "writing zone #{name}"
|
575
589
|
|
576
590
|
create_file(output_dir) {|file|
|
577
|
-
|
578
|
-
file.puts('setup')
|
579
|
-
file.puts("set_identifier('#{@name.gsub(/'/, '\\\'')}')")
|
580
591
|
|
592
|
+
file.puts("timezone #{TZDataParser.quote_str(@name)} do |tz|")
|
593
|
+
file.indent(2)
|
594
|
+
|
581
595
|
transitions = find_transitions
|
582
|
-
transitions.
|
596
|
+
transitions.output_module(file)
|
597
|
+
|
598
|
+
file.indent(-2)
|
599
|
+
file.puts('end')
|
583
600
|
}
|
584
601
|
end
|
585
602
|
|
603
|
+
# Writes an index record for this zone.
|
604
|
+
def write_index_record(file)
|
605
|
+
file.puts(" timezone #{TZDataParser.quote_str(@name)}")
|
606
|
+
end
|
607
|
+
|
586
608
|
private
|
587
609
|
def find_transitions
|
588
610
|
transitions = TZDataTransitions.new
|
@@ -711,7 +733,7 @@ module TZInfo
|
|
711
733
|
@transitions << transition
|
712
734
|
end
|
713
735
|
|
714
|
-
def
|
736
|
+
def output_module(file)
|
715
737
|
optimize
|
716
738
|
|
717
739
|
# Try and end on a transition to std if one happens in the last year.
|
@@ -725,34 +747,12 @@ module TZInfo
|
|
725
747
|
transitions = @transitions
|
726
748
|
end
|
727
749
|
|
728
|
-
|
729
|
-
|
730
|
-
if previous.nil?
|
731
|
-
# first transition
|
732
|
-
# if it has a time, need to work out what the unbounded start before
|
733
|
-
# it should have been
|
734
|
-
|
735
|
-
if transition.std_offset == 0
|
736
|
-
# treat the start time as nil
|
737
|
-
previous = transition.clone_with_at(nil)
|
738
|
-
else
|
739
|
-
first_std = @transitions.find {|t| t.std_offset == 0}
|
740
|
-
|
741
|
-
if first_std.nil?
|
742
|
-
previous = transition.clone_with_at(nil)
|
743
|
-
else
|
744
|
-
first_std.clone_with_at(nil).write_period(file, transition.at_utc)
|
745
|
-
previous = transition
|
746
|
-
end
|
747
|
-
end
|
748
|
-
else
|
749
|
-
raise 'Only the first transition can have a nil start time' if transition.at_utc.nil?
|
750
|
-
previous.write_period(file, transition.at_utc)
|
751
|
-
previous = transition
|
752
|
-
end
|
753
|
-
}
|
750
|
+
process_offsets(file)
|
751
|
+
file.puts('')
|
754
752
|
|
755
|
-
|
753
|
+
transitions.each do |t|
|
754
|
+
t.write(file)
|
755
|
+
end
|
756
756
|
end
|
757
757
|
|
758
758
|
private
|
@@ -779,7 +779,8 @@ module TZInfo
|
|
779
779
|
# Shuffle transitions up, eliminating any redundant transitions
|
780
780
|
# along the way.
|
781
781
|
if to_i == 0 ||
|
782
|
-
@transitions[to_i - 1].
|
782
|
+
@transitions[to_i - 1].utc_offset != @transitions[from_i].utc_offset ||
|
783
|
+
@transitions[to_i - 1].std_offset != @transitions[from_i].std_offset ||
|
783
784
|
@transitions[to_i - 1].zone_id != @transitions[from_i].zone_id
|
784
785
|
|
785
786
|
@transitions[to_i] = @transitions[from_i]
|
@@ -794,7 +795,65 @@ module TZInfo
|
|
794
795
|
else
|
795
796
|
@transitions = []
|
796
797
|
end
|
797
|
-
end
|
798
|
+
end
|
799
|
+
|
800
|
+
def quote_zone_id(zone_id)
|
801
|
+
if zone_id =~ %r{[\-+']}
|
802
|
+
":#{TZDataParser.quote_str(zone_id)}"
|
803
|
+
else
|
804
|
+
":#{zone_id}"
|
805
|
+
end
|
806
|
+
end
|
807
|
+
|
808
|
+
def process_offsets(file)
|
809
|
+
# A bit of a hack at the moment. The offset used to be output with
|
810
|
+
# each period (pair of transitions). They are now separated from the
|
811
|
+
# transition data. The code should probably be changed at some point to
|
812
|
+
# setup the offsets at an earlier stage.
|
813
|
+
|
814
|
+
# Assume that when this is called, the first transition is the Local
|
815
|
+
# Mean Time initial rule or a transition with no time that defines the
|
816
|
+
# offset for the entire zone.
|
817
|
+
|
818
|
+
offsets = []
|
819
|
+
|
820
|
+
# Find the first std offset. Timezones always start in std.
|
821
|
+
@transitions.each do |t|
|
822
|
+
if t.std_offset == 0
|
823
|
+
offset = {:utc_offset => t.utc_offset,
|
824
|
+
:std_offset => t.std_offset,
|
825
|
+
:zone_id => t.zone_id,
|
826
|
+
:name => 'o0'}
|
827
|
+
|
828
|
+
offsets << offset
|
829
|
+
break
|
830
|
+
end
|
831
|
+
end
|
832
|
+
|
833
|
+
@transitions.each do |t|
|
834
|
+
offset = offsets.find do |o|
|
835
|
+
o[:utc_offset] == t.utc_offset &&
|
836
|
+
o[:std_offset] == t.std_offset &&
|
837
|
+
o[:zone_id] == t.zone_id
|
838
|
+
end
|
839
|
+
|
840
|
+
unless offset
|
841
|
+
offset = {:utc_offset => t.utc_offset,
|
842
|
+
:std_offset => t.std_offset,
|
843
|
+
:zone_id => t.zone_id,
|
844
|
+
:name => "o#{offsets.length}"}
|
845
|
+
|
846
|
+
offsets << offset
|
847
|
+
end
|
848
|
+
|
849
|
+
t.offset_name = offset[:name]
|
850
|
+
end
|
851
|
+
|
852
|
+
offsets.each do |offset|
|
853
|
+
file.puts("tz.offset :#{offset[:name]}, #{offset[:utc_offset]}, #{offset[:std_offset]}, #{quote_zone_id(offset[:zone_id])}")
|
854
|
+
end
|
855
|
+
|
856
|
+
end
|
798
857
|
end
|
799
858
|
|
800
859
|
# A transition that will be used to write the periods in a zone class.
|
@@ -805,12 +864,14 @@ module TZInfo
|
|
805
864
|
attr_reader :utc_offset
|
806
865
|
attr_reader :std_offset
|
807
866
|
attr_reader :zone_id
|
867
|
+
attr_accessor :offset_name
|
808
868
|
|
809
869
|
def initialize(at_utc, utc_offset, std_offset, zone_id)
|
810
870
|
@at_utc = at_utc
|
811
871
|
@utc_offset = utc_offset
|
812
872
|
@std_offset = std_offset
|
813
873
|
@zone_id = zone_id
|
874
|
+
@offset_name = nil
|
814
875
|
end
|
815
876
|
|
816
877
|
def to_s
|
@@ -837,32 +898,20 @@ module TZInfo
|
|
837
898
|
TZDataTransition.new(at_utc, @utc_offset, @std_offset, @zone_id)
|
838
899
|
end
|
839
900
|
|
840
|
-
def
|
841
|
-
if @at_utc
|
842
|
-
file.puts "
|
843
|
-
else
|
844
|
-
file.puts "add_period(#{@at_utc.year},#{@at_utc.mon}) {TimezonePeriod.new(#{datetime_constructor(@at_utc)},#{datetime_constructor(utc_end)},#{@utc_offset},#{@std_offset},:#{quote_str(@zone_id)})}"
|
901
|
+
def write(file)
|
902
|
+
if @at_utc
|
903
|
+
file.puts "tz.transition #{@at_utc.year}, #{@at_utc.mon}, :#{@offset_name}, #{datetime_constructor(@at_utc)}"
|
845
904
|
end
|
846
905
|
end
|
847
906
|
|
848
907
|
private
|
849
|
-
def datetime_constructor(datetime)
|
850
|
-
if datetime.
|
851
|
-
'nil'
|
852
|
-
elsif (1970..2037).include?(datetime.year)
|
908
|
+
def datetime_constructor(datetime)
|
909
|
+
if (1970..2037).include?(datetime.year)
|
853
910
|
"#{Time.utc(datetime.year, datetime.mon, datetime.mday, datetime.hour, datetime.min, datetime.sec).to_i}"
|
854
911
|
else
|
855
|
-
"
|
912
|
+
"#{datetime.ajd.numerator}, #{datetime.ajd.denominator}"
|
856
913
|
end
|
857
914
|
end
|
858
|
-
|
859
|
-
def quote_str(str)
|
860
|
-
if str =~ %r{[\-+']}
|
861
|
-
"'#{str.gsub(/'/, '\\\'')}'"
|
862
|
-
else
|
863
|
-
str
|
864
|
-
end
|
865
|
-
end
|
866
915
|
end
|
867
916
|
|
868
917
|
# An instance of a rule for a year.
|
@@ -1067,6 +1116,32 @@ module TZInfo
|
|
1067
1116
|
end
|
1068
1117
|
end
|
1069
1118
|
|
1119
|
+
# A location (latitude + longitude)
|
1120
|
+
class TZDataLocation #:nodoc:
|
1121
|
+
attr_reader :latitude
|
1122
|
+
attr_reader :longitude
|
1123
|
+
|
1124
|
+
# Constructs a new TZDataLocation from a string in ISO 6709
|
1125
|
+
# sign-degrees-minutes-seconds format, either +-DDMM+-DDDMM
|
1126
|
+
# or +-DDMMSS+-DDDMMSS, first latitude (+ is north),
|
1127
|
+
# then longitude (+ is east).
|
1128
|
+
def initialize(coordinates)
|
1129
|
+
if coordinates !~ /^([+\-])([0-9]{2})([0-9]{2})([0-9]{2})?([+\-])([0-9]{3})([0-9]{2})([0-9]{2})?$/
|
1130
|
+
raise "Invalid coordinates: #{coordinates}"
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
@latitude = Rational($2.to_i) + Rational($3.to_i, 60)
|
1134
|
+
@latitude += Rational($4.to_i, 3600) unless $4.nil?
|
1135
|
+
@latitude = -@latitude if $1 == '-'
|
1136
|
+
|
1137
|
+
@longitude = Rational($6.to_i) + Rational($7.to_i, 60)
|
1138
|
+
@longitude += Rational($8.to_i, 3600) unless $8.nil?
|
1139
|
+
@longitude = -@longitude if $5 == '-'
|
1140
|
+
end
|
1141
|
+
end
|
1142
|
+
|
1143
|
+
TZDataCountryTimezone = Struct.new(:timezone, :description, :location)
|
1144
|
+
|
1070
1145
|
# An ISO 3166 country.
|
1071
1146
|
class TZDataCountry #:nodoc:
|
1072
1147
|
attr_reader :code
|
@@ -1076,42 +1151,25 @@ module TZInfo
|
|
1076
1151
|
def initialize(code, name)
|
1077
1152
|
@code = code
|
1078
1153
|
@name = name
|
1079
|
-
@zones =
|
1154
|
+
@zones = []
|
1080
1155
|
end
|
1081
1156
|
|
1157
|
+
# Adds a TZDataCountryTimezone
|
1082
1158
|
def add_zone(zone)
|
1083
|
-
@zones
|
1084
|
-
end
|
1159
|
+
@zones << zone
|
1160
|
+
end
|
1085
1161
|
|
1086
|
-
def
|
1087
|
-
|
1088
|
-
|
1162
|
+
def write_index_record(file)
|
1163
|
+
s = " country #{TZDataParser.quote_str(@code)}, #{TZDataParser.quote_str(@name)}"
|
1164
|
+
s << ' do |c|' if @zones.length > 0
|
1089
1165
|
|
1090
|
-
|
1091
|
-
file.binmode
|
1092
|
-
file.puts('require \'tzinfo/country\'')
|
1093
|
-
file.puts('module TZInfo #:nodoc:')
|
1094
|
-
file.puts('module Countries #:nodoc:')
|
1095
|
-
|
1096
|
-
file.puts("class #{@code} < Country #:nodoc:")
|
1166
|
+
file.puts s
|
1097
1167
|
|
1098
|
-
|
1099
|
-
file.puts
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
file.puts("add_zone('#{zone.name.gsub(/'/, '\\\'')}')")
|
1104
|
-
}
|
1105
|
-
|
1106
|
-
file.puts('zones_added')
|
1107
|
-
|
1108
|
-
|
1109
|
-
file.puts('end') # end class
|
1110
|
-
|
1111
|
-
|
1112
|
-
file.puts('end') # end module Countries
|
1113
|
-
file.puts('end') # end module TZInfo
|
1114
|
-
}
|
1168
|
+
@zones.each do |zone|
|
1169
|
+
file.puts " c.timezone #{TZDataParser.quote_str(zone.timezone.name)}, #{zone.location.latitude.numerator}, #{zone.location.latitude.denominator}, #{zone.location.longitude.numerator}, #{zone.location.longitude.denominator}#{zone.description.nil? ? '' : ', ' + TZDataParser.quote_str(zone.description)}"
|
1170
|
+
end
|
1171
|
+
|
1172
|
+
file.puts ' end' if @zones.length > 0
|
1115
1173
|
end
|
1116
1174
|
end
|
1117
1175
|
end
|