timezone 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a013b73f775f4c979d2cdbe2c0d147d4009e876e7e7722f2507ce485cf850508
4
- data.tar.gz: fb305a35c41aa16d593b96f50f4b702558fc41250957a2c539ee3eccacfc8984
3
+ metadata.gz: f6cefa8086edeba989ff9c7867f02a412aac2699310cffc99b0c72e2d2c0f0cf
4
+ data.tar.gz: f7b282957223d3f3a70bd503d0d9a8c12a15c0af93a6254827bbfc14ee535caa
5
5
  SHA512:
6
- metadata.gz: 3fae7c42806dc68767ace883672ae93958736515d36fb52d9a997b622028e0575cb75ad04c2f41bb21653048087e9adbf3bd323004e3b32a33333b3e1a0163d1
7
- data.tar.gz: f1da9d076345d09b58c6b85ac109b7f6500e627c847a82be2510332358025184b816f66893059bed6d1507ef3cc374b30df2381daa70592ddf66e7995d76ab16
6
+ metadata.gz: 841cadbaed9b9d1e1c0b20fad00d6c5d9eb5fac1ba6ef5afd48cd8a2a0299a215ab10caba1a4d2174a49377b839909bd8c4c9dbf78c8d90bd06f9812f39d2f98
7
+ data.tar.gz: b243f38c2bd095d6648042357133c73786899085e3a38c4d201d3cb3cb1646c00114d2be8a903bdba7edfe705e10ff18956fb188d4213ed00cfc96711295cd20
@@ -1,5 +1,10 @@
1
1
  # master (unreleased)
2
2
 
3
+ # 1.3.5
4
+
5
+ * Remove `@rules` from `Zone`'s `Marshall::dump`. ([@panthomakos][])
6
+ * Updated with `tzdata-2019b-1`. ([@panthomakos][])
7
+
3
8
  # 1.3.4
4
9
 
5
10
  * Updated with `tzdata-2019a-1`. (panthomakos)
@@ -209,3 +214,5 @@
209
214
  # 0.1.2
210
215
 
211
216
  * Fixed `#utc_offset` rule selection. (natemueller)
217
+
218
+ [@panthomakos]: https://github.com/panthomakos
@@ -6,12 +6,10 @@
6
6
 
7
7
  # How to Acquire New TZData Information
8
8
 
9
- * Download `tzdataXYZ.tar.gz` from [IANA](http://www.iana.org/time-zones).
10
- * Extract and use `zic` to load data into `/usr/share/zoneinfo`.
11
- * Run `bundle exec rake parse` to parse files in `right/` directory into
12
- the local `data` directory.
9
+ * Ensure system `tzdata` package is up to date with most recent release from [IANA](http://www.iana.org/time-zones).
10
+ * Run `bundle exec rake parse` to parse files in `posix/` directory into the local `data` directory.
11
+ * Commit changes. For an example, see [this commit](https://github.com/panthomakos/timezone/commit/5815112d7a6c8740844189db0f05281e9c98f58f).
13
12
 
14
13
  # Notes
15
14
 
16
- * How to read TZData IANA source files:
17
- http://www.cstdbill.com/tzdb/tz-how-to.html
15
+ * How to read TZData IANA source files: http://www.cstdbill.com/tzdb/tz-how-to.html
@@ -93,4 +93,6 @@
93
93
  3024000:+00:1:0
94
94
  27216000:+01:0:3600
95
95
  3628800:+00:1:0
96
+ 27216000:+01:0:3600
97
+ 3024000:+00:1:0
96
98
  1:+01:0:3600
@@ -82,4 +82,6 @@
82
82
  3024000:+00:1:0
83
83
  27216000:+01:0:3600
84
84
  3628800:+00:1:0
85
+ 27216000:+01:0:3600
86
+ 3024000:+00:1:0
85
87
  1:+01:0:3600
@@ -89,43 +89,4 @@
89
89
  10882800:-03:1:-10800
90
90
  22381200:-04:0:-14400
91
91
  9068400:-03:1:-10800
92
- 22381200:-04:0:-14400
93
- 9068400:-03:1:-10800
94
- 22381200:-04:0:-14400
95
- 9673200:-03:1:-10800
96
- 22381200:-04:0:-14400
97
- 9068400:-03:1:-10800
98
- 22381200:-04:0:-14400
99
- 9673200:-03:1:-10800
100
- 21776400:-04:0:-14400
101
- 9068400:-03:1:-10800
102
- 22381200:-04:0:-14400
103
- 9068400:-03:1:-10800
104
- 22381200:-04:0:-14400
105
- 9673200:-03:1:-10800
106
- 21776400:-04:0:-14400
107
- 9673200:-03:1:-10800
108
- 22381200:-04:0:-14400
109
- 9068400:-03:1:-10800
110
- 22381200:-04:0:-14400
111
- 9068400:-03:1:-10800
112
- 22381200:-04:0:-14400
113
- 9068400:-03:1:-10800
114
- 22381200:-04:0:-14400
115
- 9068400:-03:1:-10800
116
- 22381200:-04:0:-14400
117
- 9068400:-03:1:-10800
118
- 22986000:-04:0:-14400
119
- 9068400:-03:1:-10800
120
- 22381200:-04:0:-14400
121
- 9673200:-03:1:-10800
122
- 21776400:-04:0:-14400
123
- 9068400:-03:1:-10800
124
- 22381200:-04:0:-14400
125
- 9068400:-03:1:-10800
126
- 22381200:-04:0:-14400
127
- 9673200:-03:1:-10800
128
- 21776400:-04:0:-14400
129
- 9673200:-03:1:-10800
130
- 22381200:-04:0:-14400
131
- 1:-03:1:-10800
92
+ 1:-04:0:-14400
@@ -87,43 +87,4 @@
87
87
  10882800:-03:1:-10800
88
88
  22381200:-04:0:-14400
89
89
  9068400:-03:1:-10800
90
- 22381200:-04:0:-14400
91
- 9068400:-03:1:-10800
92
- 22381200:-04:0:-14400
93
- 9673200:-03:1:-10800
94
- 22381200:-04:0:-14400
95
- 9068400:-03:1:-10800
96
- 22381200:-04:0:-14400
97
- 9673200:-03:1:-10800
98
- 21776400:-04:0:-14400
99
- 9068400:-03:1:-10800
100
- 22381200:-04:0:-14400
101
- 9068400:-03:1:-10800
102
- 22381200:-04:0:-14400
103
- 9673200:-03:1:-10800
104
- 21776400:-04:0:-14400
105
- 9673200:-03:1:-10800
106
- 22381200:-04:0:-14400
107
- 9068400:-03:1:-10800
108
- 22381200:-04:0:-14400
109
- 9068400:-03:1:-10800
110
- 22381200:-04:0:-14400
111
- 9068400:-03:1:-10800
112
- 22381200:-04:0:-14400
113
- 9068400:-03:1:-10800
114
- 22381200:-04:0:-14400
115
- 9068400:-03:1:-10800
116
- 22986000:-04:0:-14400
117
- 9068400:-03:1:-10800
118
- 22381200:-04:0:-14400
119
- 9673200:-03:1:-10800
120
- 21776400:-04:0:-14400
121
- 9068400:-03:1:-10800
122
- 22381200:-04:0:-14400
123
- 9068400:-03:1:-10800
124
- 22381200:-04:0:-14400
125
- 9673200:-03:1:-10800
126
- 21776400:-04:0:-14400
127
- 9673200:-03:1:-10800
128
- 22381200:-04:0:-14400
129
- 1:-03:1:-10800
90
+ 1:-04:0:-14400
@@ -89,43 +89,4 @@
89
89
  10882800:-02:1:-7200
90
90
  22381200:-03:0:-10800
91
91
  9068400:-02:1:-7200
92
- 22381200:-03:0:-10800
93
- 9068400:-02:1:-7200
94
- 22381200:-03:0:-10800
95
- 9673200:-02:1:-7200
96
- 22381200:-03:0:-10800
97
- 9068400:-02:1:-7200
98
- 22381200:-03:0:-10800
99
- 9673200:-02:1:-7200
100
- 21776400:-03:0:-10800
101
- 9068400:-02:1:-7200
102
- 22381200:-03:0:-10800
103
- 9068400:-02:1:-7200
104
- 22381200:-03:0:-10800
105
- 9673200:-02:1:-7200
106
- 21776400:-03:0:-10800
107
- 9673200:-02:1:-7200
108
- 22381200:-03:0:-10800
109
- 9068400:-02:1:-7200
110
- 22381200:-03:0:-10800
111
- 9068400:-02:1:-7200
112
- 22381200:-03:0:-10800
113
- 9068400:-02:1:-7200
114
- 22381200:-03:0:-10800
115
- 9068400:-02:1:-7200
116
- 22381200:-03:0:-10800
117
- 9068400:-02:1:-7200
118
- 22986000:-03:0:-10800
119
- 9068400:-02:1:-7200
120
- 22381200:-03:0:-10800
121
- 9673200:-02:1:-7200
122
- 21776400:-03:0:-10800
123
- 9068400:-02:1:-7200
124
- 22381200:-03:0:-10800
125
- 9068400:-02:1:-7200
126
- 22381200:-03:0:-10800
127
- 9673200:-02:1:-7200
128
- 21776400:-03:0:-10800
129
- 9673200:-02:1:-7200
130
- 22381200:-03:0:-10800
131
- 1:-02:1:-7200
92
+ 1:-03:0:-10800
@@ -108,44 +108,44 @@
108
108
  18745200:EEST:1:10800
109
109
  12704400:EET:0:7200
110
110
  18745200:EEST:1:10800
111
- 13309200:EET:0:7200
112
- 18140400:EEST:1:10800
113
- 13309200:EET:0:7200
114
- 18745200:EEST:1:10800
115
- 12704400:EET:0:7200
116
- 18745200:EEST:1:10800
117
- 12704400:EET:0:7200
118
- 18745200:EEST:1:10800
119
- 12704400:EET:0:7200
120
- 18745200:EEST:1:10800
121
- 13309200:EET:0:7200
122
- 18140400:EEST:1:10800
123
- 13309200:EET:0:7200
124
- 18140400:EEST:1:10800
125
- 13309200:EET:0:7200
126
- 18745200:EEST:1:10800
127
- 12704400:EET:0:7200
128
- 18745200:EEST:1:10800
129
- 12704400:EET:0:7200
130
- 18745200:EEST:1:10800
131
- 12704400:EET:0:7200
132
- 18745200:EEST:1:10800
133
- 13309200:EET:0:7200
134
- 18140400:EEST:1:10800
135
- 13309200:EET:0:7200
136
- 18140400:EEST:1:10800
137
- 13309200:EET:0:7200
138
- 18745200:EEST:1:10800
139
- 12704400:EET:0:7200
140
- 18745200:EEST:1:10800
141
- 12704400:EET:0:7200
142
- 18745200:EEST:1:10800
143
- 12704400:EET:0:7200
144
- 18745200:EEST:1:10800
145
- 13309200:EET:0:7200
146
- 18140400:EEST:1:10800
147
- 13309200:EET:0:7200
148
- 18745200:EEST:1:10800
149
- 12704400:EET:0:7200
150
- 18745200:EEST:1:10800
111
+ 13219200:EET:0:7200
112
+ 18230400:EEST:1:10800
113
+ 13219200:EET:0:7200
114
+ 18835200:EEST:1:10800
115
+ 12614400:EET:0:7200
116
+ 18835200:EEST:1:10800
117
+ 12614400:EET:0:7200
118
+ 18835200:EEST:1:10800
119
+ 13219200:EET:0:7200
120
+ 18230400:EEST:1:10800
121
+ 13219200:EET:0:7200
122
+ 18230400:EEST:1:10800
123
+ 13219200:EET:0:7200
124
+ 18230400:EEST:1:10800
125
+ 13219200:EET:0:7200
126
+ 18835200:EEST:1:10800
127
+ 12614400:EET:0:7200
128
+ 18835200:EEST:1:10800
129
+ 13219200:EET:0:7200
130
+ 18230400:EEST:1:10800
131
+ 13219200:EET:0:7200
132
+ 18230400:EEST:1:10800
133
+ 13219200:EET:0:7200
134
+ 18230400:EEST:1:10800
135
+ 13219200:EET:0:7200
136
+ 18230400:EEST:1:10800
137
+ 13219200:EET:0:7200
138
+ 18835200:EEST:1:10800
139
+ 12614400:EET:0:7200
140
+ 18835200:EEST:1:10800
141
+ 13219200:EET:0:7200
142
+ 18230400:EEST:1:10800
143
+ 13219200:EET:0:7200
144
+ 18230400:EEST:1:10800
145
+ 13219200:EET:0:7200
146
+ 18230400:EEST:1:10800
147
+ 13219200:EET:0:7200
148
+ 18835200:EEST:1:10800
149
+ 12614400:EET:0:7200
150
+ 18835200:EEST:1:10800
151
151
  1:EET:0:7200
@@ -110,44 +110,44 @@
110
110
  18745200:EEST:1:10800
111
111
  12704400:EET:0:7200
112
112
  18745200:EEST:1:10800
113
- 13309200:EET:0:7200
114
- 18140400:EEST:1:10800
115
- 13309200:EET:0:7200
116
- 18745200:EEST:1:10800
117
- 12704400:EET:0:7200
118
- 18745200:EEST:1:10800
119
- 12704400:EET:0:7200
120
- 18745200:EEST:1:10800
121
- 12704400:EET:0:7200
122
- 18745200:EEST:1:10800
123
- 13309200:EET:0:7200
124
- 18140400:EEST:1:10800
125
- 13309200:EET:0:7200
126
- 18140400:EEST:1:10800
127
- 13309200:EET:0:7200
128
- 18745200:EEST:1:10800
129
- 12704400:EET:0:7200
130
- 18745200:EEST:1:10800
131
- 12704400:EET:0:7200
132
- 18745200:EEST:1:10800
133
- 12704400:EET:0:7200
134
- 18745200:EEST:1:10800
135
- 13309200:EET:0:7200
136
- 18140400:EEST:1:10800
137
- 13309200:EET:0:7200
138
- 18140400:EEST:1:10800
139
- 13309200:EET:0:7200
140
- 18745200:EEST:1:10800
141
- 12704400:EET:0:7200
142
- 18745200:EEST:1:10800
143
- 12704400:EET:0:7200
144
- 18745200:EEST:1:10800
145
- 12704400:EET:0:7200
146
- 18745200:EEST:1:10800
147
- 13309200:EET:0:7200
148
- 18140400:EEST:1:10800
149
- 13309200:EET:0:7200
150
- 18745200:EEST:1:10800
151
- 12704400:EET:0:7200
152
- 18745200:EEST:1:10800
113
+ 13219200:EET:0:7200
114
+ 18230400:EEST:1:10800
115
+ 13219200:EET:0:7200
116
+ 18835200:EEST:1:10800
117
+ 12614400:EET:0:7200
118
+ 18835200:EEST:1:10800
119
+ 12614400:EET:0:7200
120
+ 18835200:EEST:1:10800
121
+ 13219200:EET:0:7200
122
+ 18230400:EEST:1:10800
123
+ 13219200:EET:0:7200
124
+ 18230400:EEST:1:10800
125
+ 13219200:EET:0:7200
126
+ 18230400:EEST:1:10800
127
+ 13219200:EET:0:7200
128
+ 18835200:EEST:1:10800
129
+ 12614400:EET:0:7200
130
+ 18835200:EEST:1:10800
131
+ 13219200:EET:0:7200
132
+ 18230400:EEST:1:10800
133
+ 13219200:EET:0:7200
134
+ 18230400:EEST:1:10800
135
+ 13219200:EET:0:7200
136
+ 18230400:EEST:1:10800
137
+ 13219200:EET:0:7200
138
+ 18230400:EEST:1:10800
139
+ 13219200:EET:0:7200
140
+ 18835200:EEST:1:10800
141
+ 12614400:EET:0:7200
142
+ 18835200:EEST:1:10800
143
+ 13219200:EET:0:7200
144
+ 18230400:EEST:1:10800
145
+ 13219200:EET:0:7200
146
+ 18230400:EEST:1:10800
147
+ 13219200:EET:0:7200
148
+ 18230400:EEST:1:10800
149
+ 13219200:EET:0:7200
150
+ 18835200:EEST:1:10800
151
+ 12614400:EET:0:7200
152
+ 18835200:EEST:1:10800
153
153
  1:EET:0:7200
@@ -1,23 +1,23 @@
1
1
  -2056690801:LMT:0:27402
2
- 1155781800:HKT:0:28800
3
- 9329400:HKST:1:32400
2
+ 1155780000:HKT:0:28800
3
+ 9331200:HKST:1:32400
4
4
  7331400:HKT:0:30600
5
- 117588600:JST:0:32400
6
- 18678600:HKT:0:28800
7
- 19436400:HKST:1:32400
8
- 11494800:HKT:0:28800
9
- 22546800:HKST:1:32400
10
- 10717200:HKT:0:28800
11
- 15721200:HKST:1:32400
12
- 13309200:HKT:0:28800
13
- 18140400:HKST:1:32400
14
- 13309200:HKT:0:28800
15
- 18140400:HKST:1:32400
16
- 13309200:HKT:0:28800
17
- 18140400:HKST:1:32400
18
- 13914000:HKT:0:28800
19
- 18140400:HKST:1:32400
20
- 13309200:HKT:0:28800
5
+ 123039000:JST:0:32400
6
+ 13302000:HKT:0:28800
7
+ 19366200:HKST:1:32400
8
+ 11491200:HKT:0:28800
9
+ 19958400:HKST:1:32400
10
+ 13305600:HKT:0:28800
11
+ 15724800:HKST:1:32400
12
+ 13305600:HKT:0:28800
13
+ 18144000:HKST:1:32400
14
+ 13305600:HKT:0:28800
15
+ 18144000:HKST:1:32400
16
+ 13305600:HKT:0:28800
17
+ 18144000:HKST:1:32400
18
+ 13910400:HKT:0:28800
19
+ 18144000:HKST:1:32400
20
+ 13305600:HKT:0:28800
21
21
  18140400:HKST:1:32400
22
22
  12099600:HKT:0:28800
23
23
  19350000:HKST:1:32400
@@ -89,43 +89,4 @@
89
89
  10882800:-02:1:-7200
90
90
  22381200:-03:0:-10800
91
91
  9068400:-02:1:-7200
92
- 22381200:-03:0:-10800
93
- 9068400:-02:1:-7200
94
- 22381200:-03:0:-10800
95
- 9673200:-02:1:-7200
96
- 22381200:-03:0:-10800
97
- 9068400:-02:1:-7200
98
- 22381200:-03:0:-10800
99
- 9673200:-02:1:-7200
100
- 21776400:-03:0:-10800
101
- 9068400:-02:1:-7200
102
- 22381200:-03:0:-10800
103
- 9068400:-02:1:-7200
104
- 22381200:-03:0:-10800
105
- 9673200:-02:1:-7200
106
- 21776400:-03:0:-10800
107
- 9673200:-02:1:-7200
108
- 22381200:-03:0:-10800
109
- 9068400:-02:1:-7200
110
- 22381200:-03:0:-10800
111
- 9068400:-02:1:-7200
112
- 22381200:-03:0:-10800
113
- 9068400:-02:1:-7200
114
- 22381200:-03:0:-10800
115
- 9068400:-02:1:-7200
116
- 22381200:-03:0:-10800
117
- 9068400:-02:1:-7200
118
- 22986000:-03:0:-10800
119
- 9068400:-02:1:-7200
120
- 22381200:-03:0:-10800
121
- 9673200:-02:1:-7200
122
- 21776400:-03:0:-10800
123
- 9068400:-02:1:-7200
124
- 22381200:-03:0:-10800
125
- 9068400:-02:1:-7200
126
- 22381200:-03:0:-10800
127
- 9673200:-02:1:-7200
128
- 21776400:-03:0:-10800
129
- 9673200:-02:1:-7200
130
- 22381200:-03:0:-10800
131
- 1:-02:1:-7200
92
+ 1:-03:0:-10800
@@ -1,5 +1,5 @@
1
- -3259097397:LMT:0:2996
2
- 855532196:RMT:0:2996
1
+ -3252098997:LMT:0:2996
2
+ 848533796:RMT:0:2996
3
3
  712800000:CET:0:3600
4
4
  10278000:CEST:1:7200
5
5
  15728400:CET:0:3600
@@ -1,5 +1,5 @@
1
- -3259097397:LMT:0:2996
2
- 855532196:RMT:0:2996
1
+ -3252098997:LMT:0:2996
2
+ 848533796:RMT:0:2996
3
3
  712800000:CET:0:3600
4
4
  10278000:CEST:1:7200
5
5
  15728400:CET:0:3600
@@ -1,5 +1,5 @@
1
- -3259097397:LMT:0:2996
2
- 855532196:RMT:0:2996
1
+ -3252098997:LMT:0:2996
2
+ 848533796:RMT:0:2996
3
3
  712800000:CET:0:3600
4
4
  10278000:CEST:1:7200
5
5
  15728400:CET:0:3600
@@ -1,23 +1,23 @@
1
1
  -2056690801:LMT:0:27402
2
- 1155781800:HKT:0:28800
3
- 9329400:HKST:1:32400
2
+ 1155780000:HKT:0:28800
3
+ 9331200:HKST:1:32400
4
4
  7331400:HKT:0:30600
5
- 117588600:JST:0:32400
6
- 18678600:HKT:0:28800
7
- 19436400:HKST:1:32400
8
- 11494800:HKT:0:28800
9
- 22546800:HKST:1:32400
10
- 10717200:HKT:0:28800
11
- 15721200:HKST:1:32400
12
- 13309200:HKT:0:28800
13
- 18140400:HKST:1:32400
14
- 13309200:HKT:0:28800
15
- 18140400:HKST:1:32400
16
- 13309200:HKT:0:28800
17
- 18140400:HKST:1:32400
18
- 13914000:HKT:0:28800
19
- 18140400:HKST:1:32400
20
- 13309200:HKT:0:28800
5
+ 123039000:JST:0:32400
6
+ 13302000:HKT:0:28800
7
+ 19366200:HKST:1:32400
8
+ 11491200:HKT:0:28800
9
+ 19958400:HKST:1:32400
10
+ 13305600:HKT:0:28800
11
+ 15724800:HKST:1:32400
12
+ 13305600:HKT:0:28800
13
+ 18144000:HKST:1:32400
14
+ 13305600:HKT:0:28800
15
+ 18144000:HKST:1:32400
16
+ 13305600:HKT:0:28800
17
+ 18144000:HKST:1:32400
18
+ 13910400:HKT:0:28800
19
+ 18144000:HKST:1:32400
20
+ 13305600:HKT:0:28800
21
21
  18140400:HKST:1:32400
22
22
  12099600:HKT:0:28800
23
23
  19350000:HKST:1:32400
@@ -8,12 +8,15 @@ module Timezone # rubocop:disable Style/Documentation
8
8
  ZONE_FILE_PATH = File.expand_path(File.dirname(__FILE__) + '/../../data')
9
9
  SOURCE_BIT = 0
10
10
 
11
+ @rules = {} # cache of loaded rules
12
+
11
13
  class << self
12
14
  def load(name)
13
- raise ::Timezone::Error::InvalidZone unless valid?(name)
15
+ @rules.fetch(name) do
16
+ raise ::Timezone::Error::InvalidZone unless valid?(name)
14
17
 
15
- @rules ||= {}
16
- @rules[name] ||= parse_zone_data(get_zone_data(name))
18
+ @rules[name] = parse_zone_data(get_zone_data(name))
19
+ end
17
20
  end
18
21
 
19
22
  def names
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Timezone
4
- VERSION = '1.3.4'.freeze
4
+ VERSION = '1.3.5'.freeze
5
5
  end
@@ -179,10 +179,6 @@ module Timezone
179
179
 
180
180
  private
181
181
 
182
- def private_rules
183
- @rules ||= Loader.load(name)
184
- end
185
-
186
182
  def sanitize(time)
187
183
  time.to_time
188
184
  end
@@ -200,11 +196,15 @@ module Timezone
200
196
 
201
197
  def rule_for_local(local)
202
198
  local = local.to_i
199
+ rules = Loader.load(name)
203
200
 
204
201
  # For each rule, convert the local time into the UTC equivalent for
205
202
  # that rule offset, and then check if the UTC time matches the rule.
206
- index = binary_search(local) { |t, r| match?(t - r[OFFSET_BIT], r) }
207
- match = private_rules[index]
203
+ index =
204
+ binary_search(rules, local) do |t, r|
205
+ match?(t - r[OFFSET_BIT], r)
206
+ end
207
+ match = rules[index]
208
208
 
209
209
  utc = local - match[OFFSET_BIT]
210
210
 
@@ -213,7 +213,7 @@ module Timezone
213
213
  return RuleSet.new(:missing, [match]) if rule_for_utc(utc) != match
214
214
 
215
215
  # If the match is the last rule, then return it.
216
- return RuleSet.new(:single, [match]) if index == private_rules.length - 1
216
+ return RuleSet.new(:single, [match]) if index == rules.length - 1
217
217
 
218
218
  # If the UTC equivalent time falls within the last hour(s) of the time
219
219
  # change which were replayed during a fall-back in time, then return
@@ -234,10 +234,10 @@ module Timezone
234
234
  last_hour =
235
235
  match[SOURCE_BIT] -
236
236
  match[OFFSET_BIT] +
237
- private_rules[index + 1][OFFSET_BIT]
237
+ rules[index + 1][OFFSET_BIT]
238
238
 
239
239
  if utc > last_hour
240
- RuleSet.new(:double, private_rules[index..(index + 1)])
240
+ RuleSet.new(:double, rules[index..(index + 1)])
241
241
  else
242
242
  RuleSet.new(:single, [match])
243
243
  end
@@ -245,27 +245,28 @@ module Timezone
245
245
 
246
246
  def rule_for_utc(time)
247
247
  time = time.to_i
248
+ rules = Loader.load(name)
248
249
 
249
- private_rules[binary_search(time) { |t, r| match?(t, r) }]
250
+ rules[binary_search(rules, time) { |t, r| match?(t, r) }]
250
251
  end
251
252
 
252
253
  # Find the first rule that matches using binary search.
253
- def binary_search(time, from = 0, to = nil, &block)
254
- to = private_rules.length - 1 if to.nil?
254
+ def binary_search(rules, time, from = 0, to = nil, &block)
255
+ to = rules.length - 1 if to.nil?
255
256
 
256
257
  return from if from == to
257
258
 
258
259
  mid = (from + to).div(2)
259
260
 
260
- unless yield(time, private_rules[mid])
261
- return binary_search(time, mid + 1, to, &block)
261
+ unless yield(time, rules[mid])
262
+ return binary_search(rules, time, mid + 1, to, &block)
262
263
  end
263
264
 
264
265
  return mid if mid.zero?
265
266
 
266
- return mid unless yield(time, private_rules[mid - 1])
267
+ return mid unless yield(time, rules[mid - 1])
267
268
 
268
- binary_search(time, from, mid - 1, &block)
269
+ binary_search(rules, time, from, mid - 1, &block)
269
270
  end
270
271
  end
271
272
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timezone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pan Thomakos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-12 00:00:00.000000000 Z
11
+ date: 2019-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -747,7 +747,7 @@ requirements: []
747
747
  rubygems_version: 3.0.1
748
748
  signing_key:
749
749
  specification_version: 4
750
- summary: timezone-1.3.4
750
+ summary: timezone-1.3.5
751
751
  test_files:
752
752
  - test/data/Helsinki_rules_without_timestamps.json
753
753
  - test/data/asia