restify 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/restify/relation.rb +6 -2
- data/lib/restify/version.rb +1 -1
- data/spec/restify/relation_spec.rb +54 -1
- data/vendor/bundle/ruby/3.4.0/bundler/gems/my-rubocop-3bcd2110ca87/LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/bundler/gems/my-rubocop-3bcd2110ca87/README.md +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/CHANGELOG.md +255 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/README.rdoc +40 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/CHANGELOG.md +301 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/README.md +121 -0
- data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/README.md +48 -0
- data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/README.md +138 -0
- data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/LICENSE +56 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/CHANGELOG.md +603 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/README.md +407 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.3/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.3/README.md +167 -0
- data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/CHANGELOG.md +375 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/README.md +118 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/CHANGELOG.md +473 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/LICENSE +24 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/LICENSE.SPECS +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/README.md +137 -0
- data/vendor/bundle/ruby/3.4.0/gems/hitimes-3.1.0/LICENSE.txt +16 -0
- data/vendor/bundle/ruby/3.4.0/gems/hitimes-3.1.0/README.md +187 -0
- data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/README.md +127 -0
- data/vendor/bundle/ruby/3.4.0/gems/little-plugger-1.1.4/README.rdoc +53 -0
- data/vendor/bundle/ruby/3.4.0/gems/logger-1.7.0/README.md +104 -0
- data/vendor/bundle/ruby/3.4.0/gems/logging-2.4.0/LICENSE +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/logging-2.4.0/README.md +140 -0
- data/vendor/bundle/ruby/3.4.0/gems/minitest-5.25.5/README.rdoc +842 -0
- data/vendor/bundle/ruby/3.4.0/gems/msgpack-1.8.0/ChangeLog +368 -0
- data/vendor/bundle/ruby/3.4.0/gems/msgpack-1.8.0/LICENSE +177 -0
- data/vendor/bundle/ruby/3.4.0/gems/msgpack-1.8.0/README.md +302 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/CHANGELOG.md +275 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/README.md +121 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/CHANGELOG.md +193 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/LICENSE +201 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/README.md +68 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-common-0.22.0/CHANGELOG.md +98 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-common-0.22.0/LICENSE +201 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-common-0.22.0/README.md +62 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/CHANGELOG.md +498 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/README.md +222 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.15/CHANGELOG.md +1146 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.15/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.15/README.md +355 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/README.rdoc +155 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/README.md +107 -0
- data/vendor/bundle/ruby/3.4.0/gems/securerandom-0.4.1/README.md +72 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/CHANGELOG.md +410 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/LICENSE +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/README.md +588 -0
- data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/LICENSE +19 -0
- data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/README.md +406 -0
- data/vendor/bundle/ruby/3.4.0/gems/uri-1.0.3/README.md +55 -0
- metadata +66 -4
- data/doc/file.README.html +0 -192
@@ -0,0 +1,406 @@
|
|
1
|
+
# TZInfo - Ruby Time Zone Library
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/tzinfo) [](https://github.com/tzinfo/tzinfo/actions?query=workflow%3ATests+branch%3Amaster+event%3Apush)
|
4
|
+
|
5
|
+
[TZInfo](https://tzinfo.github.io) is a Ruby library that provides access to
|
6
|
+
time zone data and allows times to be converted using time zone rules.
|
7
|
+
|
8
|
+
|
9
|
+
## Data Sources
|
10
|
+
|
11
|
+
TZInfo requires a source of time zone data. There are two options:
|
12
|
+
|
13
|
+
1. A zoneinfo directory containing timezone definition files. These files are
|
14
|
+
generated from the [IANA Time Zone Database](https://www.iana.org/time-zones)
|
15
|
+
using the `zic` utility. Most Unix-like systems include a zoneinfo directory.
|
16
|
+
2. The TZInfo::Data library (the tzinfo-data gem). TZInfo::Data contains a set
|
17
|
+
of Ruby modules that are also generated from the IANA Time Zone Database.
|
18
|
+
|
19
|
+
By default, TZInfo will attempt to use TZInfo::Data. If TZInfo::Data is not
|
20
|
+
available (i.e. if `require 'tzinfo/data'` fails), then TZInfo will search for a
|
21
|
+
zoneinfo directory instead (using the search path specified by
|
22
|
+
`TZInfo::ZoneinfoDataSource::DEFAULT_SEARCH_PATH`).
|
23
|
+
|
24
|
+
If no data source can be found, a `TZInfo::DataSourceNotFound` exception will be
|
25
|
+
raised when TZInfo is used. Further information is available
|
26
|
+
[in the wiki](https://tzinfo.github.io/datasourcenotfound) to help resolve
|
27
|
+
`TZInfo::DataSourceNotFound` errors.
|
28
|
+
|
29
|
+
The default data source selection can be overridden by calling
|
30
|
+
`TZInfo::DataSource.set`.
|
31
|
+
|
32
|
+
Custom data sources can also be used. See the `TZInfo::DataSource.set`
|
33
|
+
documentation for further details.
|
34
|
+
|
35
|
+
|
36
|
+
## Installation
|
37
|
+
|
38
|
+
The TZInfo gem can be installed by running `gem install tzinfo` or by adding
|
39
|
+
`gem 'tzinfo'` to your `Gemfile` and running `bundle install`.
|
40
|
+
|
41
|
+
To use the Ruby modules as the data source, TZInfo::Data will also need to be
|
42
|
+
installed by running `gem install tzinfo-data` or by adding `gem 'tzinfo-data'`
|
43
|
+
to your `Gemfile`.
|
44
|
+
|
45
|
+
|
46
|
+
## IANA Time Zone Database
|
47
|
+
|
48
|
+
The data returned and used by TZInfo is sourced from the
|
49
|
+
[IANA Time Zone Database](http://www.iana.org/time-zones). The
|
50
|
+
[Theory and pragmatics of the tz code and data](https://data.iana.org/time-zones/theory.html)
|
51
|
+
document gives details of how the data is organized and managed.
|
52
|
+
|
53
|
+
|
54
|
+
## Example Usage
|
55
|
+
|
56
|
+
To use TZInfo, it must first be required with:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
require 'tzinfo'
|
60
|
+
```
|
61
|
+
|
62
|
+
The `TZInfo::Timezone` class provides access to time zone data and methods for
|
63
|
+
converting times.
|
64
|
+
|
65
|
+
The `all_identifiers` method returns a list of valid time zone identifiers:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
identifiers = TZInfo::Timezone.all_identifiers
|
69
|
+
# => ["Africa/Adibdjan", "Africa/Accra", ..., "Zulu"]
|
70
|
+
```
|
71
|
+
|
72
|
+
A `TZInfo::Timezone` instance representing an individual time zone can be
|
73
|
+
obtained with `TZInfo::Timezone.get`:
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
tz = TZInfo::Timezone.get('America/New_York')
|
77
|
+
# => #<TZInfo::DataTimezone: America/New_York>
|
78
|
+
```
|
79
|
+
|
80
|
+
A time can be converted to the local time of the time zone with `to_local`:
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
tz.to_local(Time.utc(2018, 2, 1, 12, 30, 0))
|
84
|
+
# => 2018-02-01 07:30:00 -0500
|
85
|
+
tz.to_local(Time.utc(2018, 7, 1, 12, 30, 0))
|
86
|
+
# => 2018-07-01 08:30:00 -0400
|
87
|
+
tz.to_local(Time.new(2018, 7, 1, 13, 30, 0, '+01:00'))
|
88
|
+
# => 2018-07-01 08:30:00 -0400
|
89
|
+
```
|
90
|
+
|
91
|
+
Local times with the appropriate offset for the time zone can be constructed
|
92
|
+
with `local_time`:
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
tz.local_time(2018, 2, 1, 7, 30, 0)
|
96
|
+
# => 2018-02-01 07:30:00 -0500
|
97
|
+
tz.local_time(2018, 7, 1, 8, 30, 0)
|
98
|
+
# => 2018-07-01 08:30:00 -0400
|
99
|
+
```
|
100
|
+
|
101
|
+
Local times can be converted to UTC by using `local_time` and calling `utc` on
|
102
|
+
the result:
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
tz.local_time(2018, 2, 1, 7, 30, 0).utc
|
106
|
+
# => 2018-02-01 12:30:00 UTC
|
107
|
+
tz.local_time(2018, 7, 1, 8, 30, 0).utc
|
108
|
+
# => 2018-07-01 12:30:00 UTC
|
109
|
+
```
|
110
|
+
|
111
|
+
The `local_to_utc` method can also be used to convert a time object to UTC. The
|
112
|
+
offset of the time is ignored - it is treated as if it were a local time for the
|
113
|
+
time zone:
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
tz.local_to_utc(Time.utc(2018, 2, 1, 7, 30, 0))
|
117
|
+
# => 2018-02-01 12:30:00 UTC
|
118
|
+
tz.local_to_utc(Time.new(2018, 2, 1, 7, 30, 0, '+01:00'))
|
119
|
+
# => 2018-02-01 12:30:00 UTC
|
120
|
+
```
|
121
|
+
|
122
|
+
Information about the time zone can be obtained from returned local times:
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
local_time = tz.to_local(Time.utc(2018, 2, 1, 12, 30, 0))
|
126
|
+
local_time.utc_offset # => -18000
|
127
|
+
local_time.dst? # => false
|
128
|
+
local_time.zone # => "EST"
|
129
|
+
|
130
|
+
local_time = tz.to_local(Time.utc(2018, 7, 1, 12, 30, 0))
|
131
|
+
local_time.utc_offset # => -14400
|
132
|
+
local_time.dst? # => true
|
133
|
+
local_time.zone # => "EDT"
|
134
|
+
```
|
135
|
+
|
136
|
+
Time zone information can be included when formatting times with `strftime`
|
137
|
+
using the `%z` and `%Z` directives:
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
tz.to_local(Time.utc(2018, 2, 1, 12, 30, 0)).strftime('%Y-%m-%d %H:%M:%S %z %Z')
|
141
|
+
# => "2018-02-01 07:30:00 -0500 EST"
|
142
|
+
tz.to_local(Time.utc(2018, 7, 1, 12, 30, 0)).strftime('%Y-%m-%d %H:%M:%S %z %Z')
|
143
|
+
# => "2018-07-01 08:30:00 -0400 EDT"
|
144
|
+
```
|
145
|
+
|
146
|
+
The `period_for` method can be used to obtain information about the observed
|
147
|
+
time zone information at a particular time as a `TZInfo::TimezonePeriod` object:
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
period = tz.period_for(Time.utc(2018, 7, 1, 12, 30, 0))
|
151
|
+
period.base_utc_offset # => -18000
|
152
|
+
period.std_offset # => 3600
|
153
|
+
period.observed_utc_offset # => -14400
|
154
|
+
period.abbreviation # => "EDT"
|
155
|
+
period.dst? # => true
|
156
|
+
period.local_starts_at.to_time # => 2018-03-11 03:00:00 -0400
|
157
|
+
period.local_ends_at.to_time # => 2018-11-04 02:00:00 -0400
|
158
|
+
```
|
159
|
+
|
160
|
+
A list of transitions between periods where different rules are observed can be
|
161
|
+
obtained with the `transitions_up_to` method. The result is returned as an
|
162
|
+
`Array` of `TZInfo::TimezoneTransition` objects:
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
transitions = tz.transitions_up_to(Time.utc(2019, 1, 1), Time.utc(2017, 1, 1))
|
166
|
+
transitions.map do |t|
|
167
|
+
[t.local_end_at.to_time, t.offset.observed_utc_offset, t.offset.abbreviation]
|
168
|
+
end
|
169
|
+
# => [[2017-03-12 02:00:00 -0500, -14400, "EDT"],
|
170
|
+
# [2017-11-05 02:00:00 -0400, -18000, "EST"],
|
171
|
+
# [2018-03-11 02:00:00 -0500, -14400, "EDT"],
|
172
|
+
# [2018-11-04 02:00:00 -0400, -18000, "EST"]]
|
173
|
+
```
|
174
|
+
|
175
|
+
A list of the unique offsets used by a time zone can be obtained with the
|
176
|
+
`offsets_up_to` method. The result is returned as an `Array` of
|
177
|
+
`TZInfo::TimezoneOffset` objects:
|
178
|
+
|
179
|
+
```ruby
|
180
|
+
offsets = tz.offsets_up_to(Time.utc(2019, 1, 1))
|
181
|
+
offsets.map {|o| [o.observed_utc_offset, o.abbreviation] }
|
182
|
+
# => [[-17762, "LMT"],
|
183
|
+
# [-18000, "EST"],
|
184
|
+
# [-14400, "EDT"],
|
185
|
+
# [-14400, "EWT"],
|
186
|
+
# [-14400, "EPT"]]
|
187
|
+
```
|
188
|
+
|
189
|
+
All `TZInfo::Timezone` methods that accept a time as a parameter can be used
|
190
|
+
with either instances of `Time`, `DateTime` or `TZInfo::Timestamp`. Arbitrary
|
191
|
+
`Time`-like objects that respond to both `to_i` and `subsec` and optionally
|
192
|
+
`utc_offset` will be treated as if they are instances of `Time`.
|
193
|
+
|
194
|
+
`TZInfo::Timezone` methods that both accept and return times will return an
|
195
|
+
object with a type matching that of the parameter (actually a
|
196
|
+
`TZInfo::TimeWithOffset`, `TZInfo::DateTimeWithOffset` or
|
197
|
+
`TZInfo::TimestampWithOffset` subclass when returning a local time):
|
198
|
+
|
199
|
+
```ruby
|
200
|
+
tz.to_local(Time.utc(2018, 7, 1, 12, 30, 0))
|
201
|
+
# => 2018-07-01 08:30:00 -0400
|
202
|
+
tz.to_local(DateTime.new(2018, 7, 1, 12, 30, 0))
|
203
|
+
# => #<TZInfo::DateTimeWithOffset: 2018-07-01T08:30:00-04:00 ((2458301j,45000s,0n),-14400s,2299161j)>
|
204
|
+
tz.to_local(TZInfo::Timestamp.create(2018, 7, 1, 12, 30, 0, 0, :utc))
|
205
|
+
# => #<TZInfo::TimestampWithOffset: @value=1530448200, @sub_second=0, @utc_offset=-14400, @utc=false>
|
206
|
+
```
|
207
|
+
|
208
|
+
In addition to `local_time`, which returns `Time` instances, the
|
209
|
+
`local_datetime` and `local_timestamp` methods can be used to construct local
|
210
|
+
`DateTime` and `TZInfo::Timestamp` instances with the appropriate offset:
|
211
|
+
|
212
|
+
```ruby
|
213
|
+
tz.local_time(2018, 2, 1, 7, 30, 0)
|
214
|
+
# => 2018-02-01 07:30:00 -0500
|
215
|
+
tz.local_datetime(2018, 2, 1, 7, 30, 0)
|
216
|
+
# => #<TZInfo::DateTimeWithOffset: 2018-02-01T07:30:00-05:00 ((2458151j,45000s,0n),-18000s,2299161j)>
|
217
|
+
tz.local_timestamp(2018, 2, 1, 7, 30, 0)
|
218
|
+
# => #<TZInfo::TimestampWithOffset: @value=1517488200, @sub_second=0, @utc_offset=-18000, @utc=false>
|
219
|
+
```
|
220
|
+
|
221
|
+
The `local_to_utc`, `local_time`, `local_datetime` and `local_timestamp` methods
|
222
|
+
may raise a `TZInfo::PeriodNotFound` or a `TZInfo::AmbiguousTime` exception.
|
223
|
+
`TZInfo::PeriodNotFound` signals that there is no equivalent UTC time (for
|
224
|
+
example, during the transition from standard time to daylight savings time when
|
225
|
+
the clocks are moved forward and an hour is skipped). `TZInfo::AmbiguousTime`
|
226
|
+
signals that there is more than one equivalent UTC time (for example, during the
|
227
|
+
transition from daylight savings time to standard time where the clocks are
|
228
|
+
moved back and an hour is repeated):
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
tz.local_time(2018, 3, 11, 2, 30, 0, 0)
|
232
|
+
# raises TZInfo::PeriodNotFound (2018-03-11 02:30:00 is an invalid local time.)
|
233
|
+
tz.local_time(2018, 11, 4, 1, 30, 0, 0)
|
234
|
+
# raises TZInfo::AmbiguousTime (2018-11-04 01:30:00 is an ambiguous local time.)
|
235
|
+
```
|
236
|
+
|
237
|
+
`TZInfo::PeriodNotFound` exceptions can only be resolved by adjusting the time,
|
238
|
+
for example, by advancing an hour:
|
239
|
+
|
240
|
+
```ruby
|
241
|
+
tz.local_time(2018, 3, 11, 3, 30, 0, 0)
|
242
|
+
# => 2018-03-11 03:30:00 -0400
|
243
|
+
```
|
244
|
+
|
245
|
+
`TZInfo::AmbiguousTime` exceptions can be resolved by setting the `dst`
|
246
|
+
parameter and/or specifying a block to choose one of the interpretations:
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
tz.local_time(2018, 11, 4, 1, 30, 0, 0, true)
|
250
|
+
# => 2018-11-04 01:30:00 -0400
|
251
|
+
tz.local_time(2018, 11, 4, 1, 30, 0, 0, false)
|
252
|
+
# => 2018-11-04 01:30:00 -0500
|
253
|
+
|
254
|
+
tz.local_time(2018, 11, 4, 1, 30, 0, 0) {|p| p.first }
|
255
|
+
# => 2018-11-04 01:30:00 -0400
|
256
|
+
tz.local_time(2018, 11, 4, 1, 30, 0, 0) {|p| p.last }
|
257
|
+
# => 2018-11-04 01:30:00 -0500
|
258
|
+
```
|
259
|
+
|
260
|
+
The default value of the `dst` parameter can also be set globally:
|
261
|
+
|
262
|
+
```ruby
|
263
|
+
TZInfo::Timezone.default_dst = true
|
264
|
+
tz.local_time(2018, 11, 4, 1, 30, 0, 0)
|
265
|
+
# => 2018-11-04 01:30:00 -0400
|
266
|
+
TZInfo::Timezone.default_dst = false
|
267
|
+
tz.local_time(2018, 11, 4, 1, 30, 0, 0)
|
268
|
+
# => 2018-11-04 01:30:00 -0500
|
269
|
+
```
|
270
|
+
|
271
|
+
TZInfo also provides information about
|
272
|
+
[ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) countries and
|
273
|
+
their associated time zones via the `TZInfo::Country` class.
|
274
|
+
|
275
|
+
A list of valid ISO 3166-1 (alpha-2) country codes can be obtained by calling
|
276
|
+
`TZInfo::Country.all_codes`:
|
277
|
+
|
278
|
+
```ruby
|
279
|
+
TZInfo::Country.all_codes
|
280
|
+
# => ["AD", "AE", ..., "ZW"]
|
281
|
+
```
|
282
|
+
|
283
|
+
A `TZInfo::Country` instance representing an individual time zone can be
|
284
|
+
obtained with `TZInfo::Country.get`:
|
285
|
+
|
286
|
+
```ruby
|
287
|
+
c = TZInfo::Country.get('US')
|
288
|
+
# => #<TZInfo::Country: US>
|
289
|
+
c.name
|
290
|
+
# => "United States"
|
291
|
+
```
|
292
|
+
|
293
|
+
The `zone_identifiers` method returns a list of the time zone identifiers used
|
294
|
+
in a country:
|
295
|
+
|
296
|
+
```ruby
|
297
|
+
c.zone_identifiers
|
298
|
+
# => ["America/New_York", "America/Detroit", ..., "Pacific/Honolulu"]
|
299
|
+
```
|
300
|
+
|
301
|
+
The `zone_info` method returns further information about the time zones used in
|
302
|
+
a country as an `Array` of `TZInfo::CountryTimezone` instances:
|
303
|
+
|
304
|
+
```ruby
|
305
|
+
zi = c.zone_info.first
|
306
|
+
zi.identifier # => "America/New_York"
|
307
|
+
zi.latitude.to_f.round(5) # => 40.71417
|
308
|
+
zi.longitude.to_f.round(5) # => -74.00639
|
309
|
+
zi.description # => "Eastern (most areas)"
|
310
|
+
```
|
311
|
+
|
312
|
+
The `zones` method returns an `Array` of `TZInfo::Timezone` instances for a
|
313
|
+
country. A `TZInfo::Timezone` instance can be obtained from a
|
314
|
+
`TZInfo::CountryTimezone` using the `timezone` method:
|
315
|
+
|
316
|
+
```ruby
|
317
|
+
zi.timezone.to_local(Time.utc(2018, 2, 1, 12, 30, 0))
|
318
|
+
# => 2018-02-01 07:30:00 -0500
|
319
|
+
```
|
320
|
+
|
321
|
+
For further detail, please refer to the API documentation for the
|
322
|
+
`TZInfo::Timezone` and `TZInfo::Country` classes.
|
323
|
+
|
324
|
+
|
325
|
+
## Time Zone Selection
|
326
|
+
|
327
|
+
The Time Zone Database maintainers recommend that time zone identifiers are not
|
328
|
+
made visible to end-users (see [Names of
|
329
|
+
timezones](https://data.iana.org/time-zones/theory.html#naming)).
|
330
|
+
|
331
|
+
Instead of displaying a list of time zone identifiers, time zones can be
|
332
|
+
selected by the user's country. Call `TZInfo::Country.all` to obtain a list of
|
333
|
+
`TZInfo::Country` objects, each with a unique `code` and a `name` that can be
|
334
|
+
used for display purposes.
|
335
|
+
|
336
|
+
Most countries have a single time zone. When choosing such a country, the time
|
337
|
+
zone can be inferred and selected automatically.
|
338
|
+
|
339
|
+
```ruby
|
340
|
+
croatia = TZInfo::Country.get('HR')
|
341
|
+
# => #<TZInfo::Country: HR>
|
342
|
+
croatia.zone_info.length
|
343
|
+
# => 1
|
344
|
+
croatia.zone_info[0].identifier
|
345
|
+
# => "Europe/Belgrade"
|
346
|
+
```
|
347
|
+
|
348
|
+
Some countries have multiple time zones. The `zone_info` method can be used
|
349
|
+
to obtain a list of user-friendly descriptions of the available options:
|
350
|
+
|
351
|
+
```ruby
|
352
|
+
australia = TZInfo::Country.get('AU')
|
353
|
+
# => #<TZInfo::Country: AU>
|
354
|
+
australia.zone_info.length
|
355
|
+
# => 13
|
356
|
+
australia.zone_info.map {|i| [i.identifier, i.description] }
|
357
|
+
# => [["Australia/Lord_Howe", "Lord Howe Island"],
|
358
|
+
# ["Antarctica/Macquarie", "Macquarie Island"],
|
359
|
+
# ...
|
360
|
+
# ["Australia/Eucla", "Western Australia (Eucla)"]]
|
361
|
+
```
|
362
|
+
|
363
|
+
Please note that country information available through TZInfo is intended as an
|
364
|
+
aid to help users select a time zone data appropriate for their practical needs.
|
365
|
+
It is not intended to take or endorse any position on legal or territorial
|
366
|
+
claims.
|
367
|
+
|
368
|
+
|
369
|
+
## Compatibility
|
370
|
+
|
371
|
+
TZInfo v2.0.0 requires a minimum of Ruby MRI 1.9.3 or JRuby 1.7 (in 1.9 mode or
|
372
|
+
later).
|
373
|
+
|
374
|
+
|
375
|
+
## Thread-Safety
|
376
|
+
|
377
|
+
The `TZInfo::Country` and `TZInfo::Timezone` classes are thread-safe. It is safe
|
378
|
+
to use class and instance methods of `TZInfo::Country` and `TZInfo::Timezone` in
|
379
|
+
concurrently executing threads. Instances of both classes can be shared across
|
380
|
+
thread boundaries.
|
381
|
+
|
382
|
+
|
383
|
+
## Documentation
|
384
|
+
|
385
|
+
API documentation for TZInfo is available on
|
386
|
+
[RubyDoc.info](https://www.rubydoc.info/gems/tzinfo/).
|
387
|
+
|
388
|
+
|
389
|
+
## License
|
390
|
+
|
391
|
+
TZInfo is released under the MIT license, see LICENSE for details.
|
392
|
+
|
393
|
+
|
394
|
+
## Source Code
|
395
|
+
|
396
|
+
Source code for TZInfo is available on
|
397
|
+
[GitHub](https://github.com/tzinfo/tzinfo).
|
398
|
+
|
399
|
+
|
400
|
+
## Issue Tracker
|
401
|
+
|
402
|
+
Please post any bugs, issues, feature requests or questions about TZInfo to the
|
403
|
+
[GitHub issue tracker](https://github.com/tzinfo/tzinfo/issues).
|
404
|
+
|
405
|
+
Issues with the underlying time zone data should be raised on the
|
406
|
+
[Time Zone Database Discussion mailing list](https://mm.icann.org/mailman/listinfo/tz).
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# URI
|
2
|
+
|
3
|
+
[](https://github.com/ruby/uri/actions/workflows/test.yml)
|
4
|
+
[](https://ruby.github.io/uri/)
|
5
|
+
|
6
|
+
URI is a module providing classes to handle Uniform Resource Identifiers [RFC3986](http://tools.ietf.org/html/rfc3986).
|
7
|
+
|
8
|
+
## Features
|
9
|
+
|
10
|
+
* Uniform way of handling URIs.
|
11
|
+
* Flexibility to introduce custom URI schemes.
|
12
|
+
* Flexibility to have an alternate URI::Parser (or just different patterns and regexp's).
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'uri'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install uri
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
require 'uri'
|
34
|
+
|
35
|
+
uri = URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
|
36
|
+
#=> #<URI::HTTP http://foo.com/posts?id=30&limit=5#time=1305298413>
|
37
|
+
|
38
|
+
uri.scheme #=> "http"
|
39
|
+
uri.host #=> "foo.com"
|
40
|
+
uri.path #=> "/posts"
|
41
|
+
uri.query #=> "id=30&limit=5"
|
42
|
+
uri.fragment #=> "time=1305298413"
|
43
|
+
|
44
|
+
uri.to_s #=> "http://foo.com/posts?id=30&limit=5#time=1305298413"
|
45
|
+
```
|
46
|
+
|
47
|
+
## Development
|
48
|
+
|
49
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
50
|
+
|
51
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/uri.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|
@@ -160,7 +160,6 @@ files:
|
|
160
160
|
- CHANGELOG.md
|
161
161
|
- LICENSE.txt
|
162
162
|
- README.md
|
163
|
-
- doc/file.README.html
|
164
163
|
- lib/restify.rb
|
165
164
|
- lib/restify/adapter/base.rb
|
166
165
|
- lib/restify/adapter/telemetry.rb
|
@@ -207,6 +206,69 @@ files:
|
|
207
206
|
- spec/spec_helper.rb
|
208
207
|
- spec/support/opentelemetry.rb
|
209
208
|
- spec/support/stub_server.rb
|
209
|
+
- vendor/bundle/ruby/3.4.0/bundler/gems/my-rubocop-3bcd2110ca87/LICENSE
|
210
|
+
- vendor/bundle/ruby/3.4.0/bundler/gems/my-rubocop-3bcd2110ca87/README.md
|
211
|
+
- vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/CHANGELOG.md
|
212
|
+
- vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/MIT-LICENSE
|
213
|
+
- vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/README.rdoc
|
214
|
+
- vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/CHANGELOG.md
|
215
|
+
- vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/LICENSE.txt
|
216
|
+
- vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/README.md
|
217
|
+
- vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/LICENSE.txt
|
218
|
+
- vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/README.md
|
219
|
+
- vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/README.md
|
220
|
+
- vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/LICENSE
|
221
|
+
- vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/CHANGELOG.md
|
222
|
+
- vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/LICENSE.txt
|
223
|
+
- vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/README.md
|
224
|
+
- vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.3/LICENSE
|
225
|
+
- vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.3/README.md
|
226
|
+
- vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/LICENSE.txt
|
227
|
+
- vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/CHANGELOG.md
|
228
|
+
- vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/LICENSE
|
229
|
+
- vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/README.md
|
230
|
+
- vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/CHANGELOG.md
|
231
|
+
- vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/LICENSE
|
232
|
+
- vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/LICENSE.SPECS
|
233
|
+
- vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/README.md
|
234
|
+
- vendor/bundle/ruby/3.4.0/gems/hitimes-3.1.0/LICENSE.txt
|
235
|
+
- vendor/bundle/ruby/3.4.0/gems/hitimes-3.1.0/README.md
|
236
|
+
- vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/MIT-LICENSE
|
237
|
+
- vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/README.md
|
238
|
+
- vendor/bundle/ruby/3.4.0/gems/little-plugger-1.1.4/README.rdoc
|
239
|
+
- vendor/bundle/ruby/3.4.0/gems/logger-1.7.0/README.md
|
240
|
+
- vendor/bundle/ruby/3.4.0/gems/logging-2.4.0/LICENSE
|
241
|
+
- vendor/bundle/ruby/3.4.0/gems/logging-2.4.0/README.md
|
242
|
+
- vendor/bundle/ruby/3.4.0/gems/minitest-5.25.5/README.rdoc
|
243
|
+
- vendor/bundle/ruby/3.4.0/gems/msgpack-1.8.0/ChangeLog
|
244
|
+
- vendor/bundle/ruby/3.4.0/gems/msgpack-1.8.0/LICENSE
|
245
|
+
- vendor/bundle/ruby/3.4.0/gems/msgpack-1.8.0/README.md
|
246
|
+
- vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/CHANGELOG.md
|
247
|
+
- vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/LICENSE.md
|
248
|
+
- vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/README.md
|
249
|
+
- vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/CHANGELOG.md
|
250
|
+
- vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/LICENSE
|
251
|
+
- vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/README.md
|
252
|
+
- vendor/bundle/ruby/3.4.0/gems/opentelemetry-common-0.22.0/CHANGELOG.md
|
253
|
+
- vendor/bundle/ruby/3.4.0/gems/opentelemetry-common-0.22.0/LICENSE
|
254
|
+
- vendor/bundle/ruby/3.4.0/gems/opentelemetry-common-0.22.0/README.md
|
255
|
+
- vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/CHANGELOG.md
|
256
|
+
- vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/LICENSE.txt
|
257
|
+
- vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/README.md
|
258
|
+
- vendor/bundle/ruby/3.4.0/gems/rack-3.1.15/CHANGELOG.md
|
259
|
+
- vendor/bundle/ruby/3.4.0/gems/rack-3.1.15/MIT-LICENSE
|
260
|
+
- vendor/bundle/ruby/3.4.0/gems/rack-3.1.15/README.md
|
261
|
+
- vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/MIT-LICENSE
|
262
|
+
- vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/README.rdoc
|
263
|
+
- vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/LICENSE
|
264
|
+
- vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/README.md
|
265
|
+
- vendor/bundle/ruby/3.4.0/gems/securerandom-0.4.1/README.md
|
266
|
+
- vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/CHANGELOG.md
|
267
|
+
- vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/LICENSE
|
268
|
+
- vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/README.md
|
269
|
+
- vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/LICENSE
|
270
|
+
- vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/README.md
|
271
|
+
- vendor/bundle/ruby/3.4.0/gems/uri-1.0.3/README.md
|
210
272
|
homepage: https://github.com/jgraichen/restify
|
211
273
|
licenses:
|
212
274
|
- LGPL-3.0+
|
@@ -226,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
288
|
- !ruby/object:Gem::Version
|
227
289
|
version: '0'
|
228
290
|
requirements: []
|
229
|
-
rubygems_version: 3.6.
|
291
|
+
rubygems_version: 3.6.7
|
230
292
|
specification_version: 4
|
231
293
|
summary: An experimental hypermedia REST client.
|
232
294
|
test_files: []
|