rbs 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +23 -0
- data/README.md +6 -1
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +472 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1059 -139
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2315 -316
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/cli.rb +45 -1
- data/lib/rbs/definition_builder.rb +5 -1
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +59 -0
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1146 -144
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/net-http.rbs +1492 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +420 -106
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +556 -327
- data/stdlib/uri/0/http.rbs +26 -115
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +17 -5
- data/lib/rbs/location.rb +0 -221
data/stdlib/date/0/date_time.rbs
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
# <!-- rdoc-file=ext/date/date_core.c -->
|
1
2
|
# ## DateTime
|
2
3
|
#
|
3
4
|
# A subclass of Date that easily handles date, hour, minute, second, and offset.
|
4
5
|
#
|
6
|
+
# DateTime class is considered deprecated. Use Time class.
|
7
|
+
#
|
5
8
|
# DateTime does not consider any leap seconds, does not track any summer time
|
6
9
|
# rules.
|
7
10
|
#
|
@@ -59,17 +62,17 @@
|
|
59
62
|
# ### When should you use DateTime and when should you use Time?
|
60
63
|
#
|
61
64
|
# It's a common misconception that [William
|
62
|
-
# Shakespeare](
|
63
|
-
# Cervantes](
|
65
|
+
# Shakespeare](https://en.wikipedia.org/wiki/William_Shakespeare) and [Miguel de
|
66
|
+
# Cervantes](https://en.wikipedia.org/wiki/Miguel_de_Cervantes) died on the same
|
64
67
|
# day in history - so much so that UNESCO named April 23 as [World Book Day
|
65
|
-
# because of this fact](
|
68
|
+
# because of this fact](https://en.wikipedia.org/wiki/World_Book_Day). However,
|
66
69
|
# because England hadn't yet adopted the [Gregorian Calendar
|
67
|
-
# Reform](
|
68
|
-
# wouldn't until
|
69
|
-
# [1752](
|
70
|
+
# Reform](https://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform)
|
71
|
+
# (and wouldn't until
|
72
|
+
# [1752](https://en.wikipedia.org/wiki/Calendar_(New_Style)_Act_1750)) their
|
70
73
|
# deaths are actually 10 days apart. Since Ruby's Time class implements a
|
71
74
|
# [proleptic Gregorian
|
72
|
-
# calendar](
|
75
|
+
# calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar) and has
|
73
76
|
# no concept of calendar reform there's no way to express this with Time
|
74
77
|
# objects. This is where DateTime steps in:
|
75
78
|
#
|
@@ -112,7 +115,7 @@
|
|
112
115
|
# #=> Fri, 04 May 1753 00:00:00 +0000
|
113
116
|
#
|
114
117
|
# As you can see, if we're accurately tracking the number of [solar
|
115
|
-
# years](
|
118
|
+
# years](https://en.wikipedia.org/wiki/Tropical_year) since Shakespeare's
|
116
119
|
# birthday then the correct anniversary date would be the 4th May and not the
|
117
120
|
# 23rd April.
|
118
121
|
#
|
@@ -122,12 +125,17 @@
|
|
122
125
|
# a historical context you'll want to use DateTime to avoid making the same
|
123
126
|
# mistakes as UNESCO. If you also have to deal with timezones then best of luck
|
124
127
|
# - just bear in mind that you'll probably be dealing with [local solar
|
125
|
-
# times](
|
128
|
+
# times](https://en.wikipedia.org/wiki/Solar_time), since it wasn't until the
|
126
129
|
# 19th century that the introduction of the railways necessitated the need for
|
127
|
-
# [Standard Time](
|
130
|
+
# [Standard Time](https://en.wikipedia.org/wiki/Standard_time#Great_Britain) and
|
128
131
|
# eventually timezones.
|
129
132
|
#
|
130
133
|
class DateTime < Date
|
134
|
+
# <!--
|
135
|
+
# rdoc-file=ext/date/date_core.c
|
136
|
+
# - DateTime.civil([year=-4712[, month=1[, mday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
137
|
+
# - DateTime.new([year=-4712[, month=1[, mday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
138
|
+
# -->
|
131
139
|
# Creates a DateTime object denoting the given calendar date.
|
132
140
|
#
|
133
141
|
# DateTime.new(2001,2,3) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
|
@@ -138,6 +146,10 @@ class DateTime < Date
|
|
138
146
|
#
|
139
147
|
def initialize: (?Integer year, ?Integer month, ?Integer mday, ?Integer hour, ?Integer minute, ?Integer second, ?Integer offset, ?Integer start) -> void
|
140
148
|
|
149
|
+
# <!--
|
150
|
+
# rdoc-file=ext/date/date_core.c
|
151
|
+
# - DateTime._strptime(string[, format='%FT%T%z']) -> hash
|
152
|
+
# -->
|
141
153
|
# Parses the given representation of date and time with the given template, and
|
142
154
|
# returns a hash of parsed elements. _strptime does not support specification
|
143
155
|
# of flags and width unlike strftime.
|
@@ -146,6 +158,11 @@ class DateTime < Date
|
|
146
158
|
#
|
147
159
|
def self._strptime: (String str, ?String format) -> Hash[Symbol, Integer | String]
|
148
160
|
|
161
|
+
# <!--
|
162
|
+
# rdoc-file=ext/date/date_core.c
|
163
|
+
# - DateTime.civil([year=-4712[, month=1[, mday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
164
|
+
# - DateTime.new([year=-4712[, month=1[, mday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
165
|
+
# -->
|
149
166
|
# Creates a DateTime object denoting the given calendar date.
|
150
167
|
#
|
151
168
|
# DateTime.new(2001,2,3) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
|
@@ -156,6 +173,10 @@ class DateTime < Date
|
|
156
173
|
#
|
157
174
|
def self.civil: (?Integer year, ?Integer month, ?Integer mday, ?Integer hour, ?Integer minute, ?Integer second, ?Integer offset, ?Integer start) -> DateTime
|
158
175
|
|
176
|
+
# <!--
|
177
|
+
# rdoc-file=ext/date/date_core.c
|
178
|
+
# - DateTime.commercial([cwyear=-4712[, cweek=1[, cwday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
179
|
+
# -->
|
159
180
|
# Creates a DateTime object denoting the given week date.
|
160
181
|
#
|
161
182
|
# DateTime.commercial(2001) #=> #<DateTime: 2001-01-01T00:00:00+00:00 ...>
|
@@ -165,14 +186,26 @@ class DateTime < Date
|
|
165
186
|
#
|
166
187
|
def self.commercial: (?Integer cwyear, ?Integer cweek, ?Integer cwday, ?Integer hour, ?Integer minute, ?Integer second, ?Integer offset, ?Integer start) -> DateTime
|
167
188
|
|
189
|
+
# <!--
|
190
|
+
# rdoc-file=ext/date/date_core.c
|
191
|
+
# - DateTime.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY]) -> datetime
|
192
|
+
# -->
|
168
193
|
# Creates a new DateTime object by parsing from a string according to some RFC
|
169
194
|
# 2616 format.
|
170
195
|
#
|
171
196
|
# DateTime.httpdate('Sat, 03 Feb 2001 04:05:06 GMT')
|
172
197
|
# #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...>
|
173
198
|
#
|
199
|
+
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
200
|
+
# stop this check by passing `limit: nil`, but note that it may take a long time
|
201
|
+
# to parse.
|
202
|
+
#
|
174
203
|
def self.httpdate: (String str, ?Integer start) -> DateTime
|
175
204
|
|
205
|
+
# <!--
|
206
|
+
# rdoc-file=ext/date/date_core.c
|
207
|
+
# - DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime
|
208
|
+
# -->
|
176
209
|
# Creates a new DateTime object by parsing from a string according to some
|
177
210
|
# typical ISO 8601 formats.
|
178
211
|
#
|
@@ -183,8 +216,16 @@ class DateTime < Date
|
|
183
216
|
# DateTime.iso8601('2001-W05-6T04:05:06+07:00')
|
184
217
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
185
218
|
#
|
219
|
+
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
220
|
+
# stop this check by passing `limit: nil`, but note that it may take a long time
|
221
|
+
# to parse.
|
222
|
+
#
|
186
223
|
def self.iso8601: (String str, ?Integer start) -> DateTime
|
187
224
|
|
225
|
+
# <!--
|
226
|
+
# rdoc-file=ext/date/date_core.c
|
227
|
+
# - DateTime.jd([jd=0[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]) -> datetime
|
228
|
+
# -->
|
188
229
|
# Creates a DateTime object denoting the given chronological Julian day number.
|
189
230
|
#
|
190
231
|
# DateTime.jd(2451944) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
|
@@ -194,6 +235,10 @@ class DateTime < Date
|
|
194
235
|
#
|
195
236
|
def self.jd: (?Integer jd, ?Integer hour, ?Integer minute, ?Integer second, ?Integer offset, ?Integer start) -> DateTime
|
196
237
|
|
238
|
+
# <!--
|
239
|
+
# rdoc-file=ext/date/date_core.c
|
240
|
+
# - DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime
|
241
|
+
# -->
|
197
242
|
# Creates a new DateTime object by parsing from a string according to some
|
198
243
|
# typical JIS X 0301 formats.
|
199
244
|
#
|
@@ -205,14 +250,26 @@ class DateTime < Date
|
|
205
250
|
# DateTime.jisx0301('13.02.03T04:05:06+07:00')
|
206
251
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
207
252
|
#
|
253
|
+
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
254
|
+
# stop this check by passing `limit: nil`, but note that it may take a long time
|
255
|
+
# to parse.
|
256
|
+
#
|
208
257
|
def self.jisx0301: (String str, ?Integer start) -> DateTime
|
209
258
|
|
259
|
+
# <!--
|
260
|
+
# rdoc-file=ext/date/date_core.c
|
261
|
+
# - DateTime.now([start=Date::ITALY]) -> datetime
|
262
|
+
# -->
|
210
263
|
# Creates a DateTime object denoting the present time.
|
211
264
|
#
|
212
265
|
# DateTime.now #=> #<DateTime: 2011-06-11T21:20:44+09:00 ...>
|
213
266
|
#
|
214
267
|
def self.now: (?Integer start) -> DateTime
|
215
268
|
|
269
|
+
# <!--
|
270
|
+
# rdoc-file=ext/date/date_core.c
|
271
|
+
# - DateTime.ordinal([year=-4712[, yday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]) -> datetime
|
272
|
+
# -->
|
216
273
|
# Creates a DateTime object denoting the given ordinal date.
|
217
274
|
#
|
218
275
|
# DateTime.ordinal(2001,34) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
|
@@ -223,8 +280,16 @@ class DateTime < Date
|
|
223
280
|
#
|
224
281
|
def self.ordinal: (?Integer year, ?Integer yday, ?Integer hour, ?Integer minute, ?Integer second, ?Integer offset, ?Integer start) -> DateTime
|
225
282
|
|
283
|
+
# <!--
|
284
|
+
# rdoc-file=ext/date/date_core.c
|
285
|
+
# - DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]], limit: 128) -> datetime
|
286
|
+
# -->
|
226
287
|
# Parses the given representation of date and time, and creates a DateTime
|
227
|
-
# object.
|
288
|
+
# object.
|
289
|
+
#
|
290
|
+
# This method *does not* function as a validator. If the input string does not
|
291
|
+
# match valid formats strictly, you may get a cryptic result. Should consider
|
292
|
+
# to use `DateTime.strptime` instead of this method as possible.
|
228
293
|
#
|
229
294
|
# If the optional second argument is true and the detected year is in the range
|
230
295
|
# "00" to "99", makes it full.
|
@@ -236,32 +301,66 @@ class DateTime < Date
|
|
236
301
|
# DateTime.parse('3rd Feb 2001 04:05:06 PM')
|
237
302
|
# #=> #<DateTime: 2001-02-03T16:05:06+00:00 ...>
|
238
303
|
#
|
304
|
+
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
305
|
+
# stop this check by passing `limit: nil`, but note that it may take a long time
|
306
|
+
# to parse.
|
307
|
+
#
|
239
308
|
def self.parse: (String str, ?boolish complete, ?Integer start) -> DateTime
|
240
309
|
|
310
|
+
# <!--
|
311
|
+
# rdoc-file=ext/date/date_core.c
|
312
|
+
# - DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> datetime
|
313
|
+
# - DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> datetime
|
314
|
+
# -->
|
241
315
|
# Creates a new DateTime object by parsing from a string according to some
|
242
316
|
# typical RFC 2822 formats.
|
243
317
|
#
|
244
318
|
# DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700')
|
245
319
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
246
320
|
#
|
321
|
+
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
322
|
+
# stop this check by passing `limit: nil`, but note that it may take a long time
|
323
|
+
# to parse.
|
324
|
+
#
|
247
325
|
def self.rfc2822: (String str, ?Integer start) -> DateTime
|
248
326
|
|
327
|
+
# <!--
|
328
|
+
# rdoc-file=ext/date/date_core.c
|
329
|
+
# - DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime
|
330
|
+
# -->
|
249
331
|
# Creates a new DateTime object by parsing from a string according to some
|
250
332
|
# typical RFC 3339 formats.
|
251
333
|
#
|
252
334
|
# DateTime.rfc3339('2001-02-03T04:05:06+07:00')
|
253
335
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
254
336
|
#
|
337
|
+
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
338
|
+
# stop this check by passing `limit: nil`, but note that it may take a long time
|
339
|
+
# to parse.
|
340
|
+
#
|
255
341
|
def self.rfc3339: (String str, ?Integer start) -> DateTime
|
256
342
|
|
343
|
+
# <!--
|
344
|
+
# rdoc-file=ext/date/date_core.c
|
345
|
+
# - DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> datetime
|
346
|
+
# - DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> datetime
|
347
|
+
# -->
|
257
348
|
# Creates a new DateTime object by parsing from a string according to some
|
258
349
|
# typical RFC 2822 formats.
|
259
350
|
#
|
260
351
|
# DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700')
|
261
352
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
262
353
|
#
|
354
|
+
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
355
|
+
# stop this check by passing `limit: nil`, but note that it may take a long time
|
356
|
+
# to parse.
|
357
|
+
#
|
263
358
|
def self.rfc822: (String str, ?Integer start) -> DateTime
|
264
359
|
|
360
|
+
# <!--
|
361
|
+
# rdoc-file=ext/date/date_core.c
|
362
|
+
# - DateTime.strptime([string='-4712-01-01T00:00:00+00:00'[, format='%FT%T%z'[ ,start=Date::ITALY]]]) -> datetime
|
363
|
+
# -->
|
265
364
|
# Parses the given representation of date and time with the given template, and
|
266
365
|
# creates a DateTime object. strptime does not support specification of flags
|
267
366
|
# and width unlike strftime.
|
@@ -287,22 +386,39 @@ class DateTime < Date
|
|
287
386
|
#
|
288
387
|
def self.strptime: (String str, ?String format, ?Integer start) -> DateTime
|
289
388
|
|
389
|
+
# <!--
|
390
|
+
# rdoc-file=ext/date/date_core.c
|
391
|
+
# - DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime
|
392
|
+
# -->
|
290
393
|
# Creates a new DateTime object by parsing from a string according to some
|
291
394
|
# typical XML Schema formats.
|
292
395
|
#
|
293
396
|
# DateTime.xmlschema('2001-02-03T04:05:06+07:00')
|
294
397
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
295
398
|
#
|
399
|
+
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
400
|
+
# stop this check by passing `limit: nil`, but note that it may take a long time
|
401
|
+
# to parse.
|
402
|
+
#
|
296
403
|
def self.xmlschema: (String str, ?Integer start) -> DateTime
|
297
404
|
|
298
405
|
public
|
299
406
|
|
407
|
+
# <!--
|
408
|
+
# rdoc-file=ext/date/date_core.c
|
409
|
+
# - d.hour -> fixnum
|
410
|
+
# -->
|
300
411
|
# Returns the hour (0-23).
|
301
412
|
#
|
302
413
|
# DateTime.new(2001,2,3,4,5,6).hour #=> 4
|
303
414
|
#
|
304
415
|
def hour: () -> Integer
|
305
416
|
|
417
|
+
# <!--
|
418
|
+
# rdoc-file=ext/date/date_core.c
|
419
|
+
# - dt.iso8601([n=0]) -> string
|
420
|
+
# - dt.xmlschema([n=0]) -> string
|
421
|
+
# -->
|
306
422
|
# This method is equivalent to strftime('%FT%T%:z'). The optional argument `n`
|
307
423
|
# is the number of digits for fractional seconds.
|
308
424
|
#
|
@@ -311,6 +427,10 @@ class DateTime < Date
|
|
311
427
|
#
|
312
428
|
def iso8601: (?Integer n) -> String
|
313
429
|
|
430
|
+
# <!--
|
431
|
+
# rdoc-file=ext/date/date_core.c
|
432
|
+
# - dt.jisx0301([n=0]) -> string
|
433
|
+
# -->
|
314
434
|
# Returns a string in a JIS X 0301 format. The optional argument `n` is the
|
315
435
|
# number of digits for fractional seconds.
|
316
436
|
#
|
@@ -319,18 +439,28 @@ class DateTime < Date
|
|
319
439
|
#
|
320
440
|
def jisx0301: (?Integer n) -> String
|
321
441
|
|
442
|
+
# <!--
|
443
|
+
# rdoc-file=ext/date/date_core.c
|
444
|
+
# - d.min -> fixnum
|
445
|
+
# - d.minute -> fixnum
|
446
|
+
# -->
|
322
447
|
# Returns the minute (0-59).
|
323
448
|
#
|
324
449
|
# DateTime.new(2001,2,3,4,5,6).min #=> 5
|
325
450
|
#
|
326
451
|
def min: () -> Integer
|
327
452
|
|
453
|
+
# <!-- rdoc-file=ext/date/date_core.c -->
|
328
454
|
# Returns the minute (0-59).
|
329
455
|
#
|
330
456
|
# DateTime.new(2001,2,3,4,5,6).min #=> 5
|
331
457
|
#
|
332
458
|
def minute: () -> Integer
|
333
459
|
|
460
|
+
# <!--
|
461
|
+
# rdoc-file=ext/date/date_core.c
|
462
|
+
# - d.new_offset([offset=0]) -> date
|
463
|
+
# -->
|
334
464
|
# Duplicates self and resets its offset.
|
335
465
|
#
|
336
466
|
# d = DateTime.new(2001,2,3,4,5,6,'-02:00')
|
@@ -339,12 +469,20 @@ class DateTime < Date
|
|
339
469
|
#
|
340
470
|
def new_offset: (?String offset) -> DateTime
|
341
471
|
|
472
|
+
# <!--
|
473
|
+
# rdoc-file=ext/date/date_core.c
|
474
|
+
# - d.offset -> rational
|
475
|
+
# -->
|
342
476
|
# Returns the offset.
|
343
477
|
#
|
344
478
|
# DateTime.parse('04pm+0730').offset #=> (5/16)
|
345
479
|
#
|
346
480
|
def offset: () -> Rational
|
347
481
|
|
482
|
+
# <!--
|
483
|
+
# rdoc-file=ext/date/date_core.c
|
484
|
+
# - dt.rfc3339([n=0]) -> string
|
485
|
+
# -->
|
348
486
|
# This method is equivalent to strftime('%FT%T%:z'). The optional argument `n`
|
349
487
|
# is the number of digits for fractional seconds.
|
350
488
|
#
|
@@ -353,30 +491,46 @@ class DateTime < Date
|
|
353
491
|
#
|
354
492
|
def rfc3339: (?Integer n) -> String
|
355
493
|
|
494
|
+
# <!--
|
495
|
+
# rdoc-file=ext/date/date_core.c
|
496
|
+
# - d.sec -> fixnum
|
497
|
+
# - d.second -> fixnum
|
498
|
+
# -->
|
356
499
|
# Returns the second (0-59).
|
357
500
|
#
|
358
501
|
# DateTime.new(2001,2,3,4,5,6).sec #=> 6
|
359
502
|
#
|
360
503
|
def sec: () -> Integer
|
361
504
|
|
505
|
+
# <!--
|
506
|
+
# rdoc-file=ext/date/date_core.c
|
507
|
+
# - d.sec_fraction -> rational
|
508
|
+
# - d.second_fraction -> rational
|
509
|
+
# -->
|
362
510
|
# Returns the fractional part of the second.
|
363
511
|
#
|
364
512
|
# DateTime.new(2001,2,3,4,5,6.5).sec_fraction #=> (1/2)
|
365
513
|
#
|
366
514
|
def sec_fraction: () -> Rational
|
367
515
|
|
516
|
+
# <!-- rdoc-file=ext/date/date_core.c -->
|
368
517
|
# Returns the second (0-59).
|
369
518
|
#
|
370
519
|
# DateTime.new(2001,2,3,4,5,6).sec #=> 6
|
371
520
|
#
|
372
521
|
def second: () -> Integer
|
373
522
|
|
523
|
+
# <!-- rdoc-file=ext/date/date_core.c -->
|
374
524
|
# Returns the fractional part of the second.
|
375
525
|
#
|
376
526
|
# DateTime.new(2001,2,3,4,5,6.5).sec_fraction #=> (1/2)
|
377
527
|
#
|
378
528
|
def second_fraction: () -> Rational
|
379
529
|
|
530
|
+
# <!--
|
531
|
+
# rdoc-file=ext/date/date_core.c
|
532
|
+
# - dt.strftime([format='%FT%T%:z']) -> string
|
533
|
+
# -->
|
380
534
|
# Formats date according to the directives in the given format string. The
|
381
535
|
# directives begin with a percent (%) character. Any text not listed as a
|
382
536
|
# directive will be passed through to the output string.
|
@@ -484,7 +638,7 @@ class DateTime < Date
|
|
484
638
|
# %c - date and time (%a %b %e %T %Y)
|
485
639
|
# %D - Date (%m/%d/%y)
|
486
640
|
# %F - The ISO 8601 date format (%Y-%m-%d)
|
487
|
-
# %v - VMS date (%e
|
641
|
+
# %v - VMS date (%e-%^b-%Y)
|
488
642
|
# %x - Same as %D
|
489
643
|
# %X - Same as %T
|
490
644
|
# %r - 12-hour time (%I:%M:%S %p)
|
@@ -546,14 +700,26 @@ class DateTime < Date
|
|
546
700
|
#
|
547
701
|
def strftime: (?String format) -> String
|
548
702
|
|
703
|
+
# <!--
|
704
|
+
# rdoc-file=ext/date/date_core.c
|
705
|
+
# - dt.to_date -> date
|
706
|
+
# -->
|
549
707
|
# Returns a Date object which denotes self.
|
550
708
|
#
|
551
709
|
def to_date: () -> Date
|
552
710
|
|
711
|
+
# <!--
|
712
|
+
# rdoc-file=ext/date/date_core.c
|
713
|
+
# - dt.to_datetime -> self
|
714
|
+
# -->
|
553
715
|
# Returns self.
|
554
716
|
#
|
555
717
|
def to_datetime: () -> DateTime
|
556
718
|
|
719
|
+
# <!--
|
720
|
+
# rdoc-file=ext/date/date_core.c
|
721
|
+
# - dt.to_s -> string
|
722
|
+
# -->
|
557
723
|
# Returns a string in an ISO 8601 format. (This method doesn't use the expanded
|
558
724
|
# representations.)
|
559
725
|
#
|
@@ -562,10 +728,15 @@ class DateTime < Date
|
|
562
728
|
#
|
563
729
|
def to_s: () -> String
|
564
730
|
|
731
|
+
# <!--
|
732
|
+
# rdoc-file=ext/date/date_core.c
|
733
|
+
# - dt.to_time -> time
|
734
|
+
# -->
|
565
735
|
# Returns a Time object which denotes self.
|
566
736
|
#
|
567
737
|
def to_time: () -> Time
|
568
738
|
|
739
|
+
# <!-- rdoc-file=ext/date/date_core.c -->
|
569
740
|
# This method is equivalent to strftime('%FT%T%:z'). The optional argument `n`
|
570
741
|
# is the number of digits for fractional seconds.
|
571
742
|
#
|
@@ -574,6 +745,10 @@ class DateTime < Date
|
|
574
745
|
#
|
575
746
|
def xmlschema: (?Integer n) -> String
|
576
747
|
|
748
|
+
# <!--
|
749
|
+
# rdoc-file=ext/date/date_core.c
|
750
|
+
# - d.zone -> string
|
751
|
+
# -->
|
577
752
|
# Returns the timezone.
|
578
753
|
#
|
579
754
|
# DateTime.parse('04pm+0730').zone #=> "+07:30"
|