date 3.1.0 → 3.2.1
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/ext/date/date_core.c +306 -94
- data/ext/date/date_strftime.c +1 -1
- data/ext/date/extconf.rb +4 -2
- data/ext/date/prereq.mk +7 -0
- data/ext/date/zonetab.h +7 -7
- data/lib/date.rb +2 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5231d3c74af9144770aee55ae284bd44c05500d08708715c373969db8030b2f8
|
4
|
+
data.tar.gz: 2a391128926d0fb3e544bb84b0dfba18b0524fe63069b162c1e7b3875a91f5e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d949a4a1a7bd253d1437ace0831055a52e36d079ebacd42529f0d670c4388ad3836080850d364973304f0a3423442e5af228249d32c21c59208db9ba4ab8d17
|
7
|
+
data.tar.gz: 872119e3e9d903e5ed9b6752fc6569b6ae6add45fe909b754d740dd1cd5e07163ab0adab3446489d014695db282ddb98e2992616934ead591c06afaf4f682573
|
data/ext/date/date_core.c
CHANGED
@@ -2973,6 +2973,10 @@ d_lite_memsize(const void *ptr)
|
|
2973
2973
|
return complex_dat_p(dat) ? sizeof(struct ComplexDateData) : sizeof(struct SimpleDateData);
|
2974
2974
|
}
|
2975
2975
|
|
2976
|
+
#ifndef HAVE_RB_EXT_RACTOR_SAFE
|
2977
|
+
# define RUBY_TYPED_FROZEN_SHAREABLE 0
|
2978
|
+
#endif
|
2979
|
+
|
2976
2980
|
static const rb_data_type_t d_lite_type = {
|
2977
2981
|
"Date",
|
2978
2982
|
{d_lite_gc_mark, RUBY_TYPED_DEFAULT_FREE, d_lite_memsize,},
|
@@ -4324,12 +4328,37 @@ date_s_strptime(int argc, VALUE *argv, VALUE klass)
|
|
4324
4328
|
|
4325
4329
|
VALUE date__parse(VALUE str, VALUE comp);
|
4326
4330
|
|
4331
|
+
static size_t
|
4332
|
+
get_limit(VALUE opt)
|
4333
|
+
{
|
4334
|
+
if (!NIL_P(opt)) {
|
4335
|
+
VALUE limit = rb_hash_aref(opt, ID2SYM(rb_intern("limit")));
|
4336
|
+
if (NIL_P(limit)) return SIZE_MAX;
|
4337
|
+
return NUM2SIZET(limit);
|
4338
|
+
}
|
4339
|
+
return 128;
|
4340
|
+
}
|
4341
|
+
|
4342
|
+
static void
|
4343
|
+
check_limit(VALUE str, VALUE opt)
|
4344
|
+
{
|
4345
|
+
StringValue(str);
|
4346
|
+
size_t slen = RSTRING_LEN(str);
|
4347
|
+
size_t limit = get_limit(opt);
|
4348
|
+
if (slen > limit) {
|
4349
|
+
rb_raise(rb_eArgError,
|
4350
|
+
"string length (%"PRI_SIZE_PREFIX"u) exceeds the limit %"PRI_SIZE_PREFIX"u", slen, limit);
|
4351
|
+
}
|
4352
|
+
}
|
4353
|
+
|
4327
4354
|
static VALUE
|
4328
4355
|
date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
4329
4356
|
{
|
4330
|
-
VALUE vstr, vcomp, hash;
|
4357
|
+
VALUE vstr, vcomp, hash, opt;
|
4331
4358
|
|
4332
|
-
rb_scan_args(argc, argv, "11", &vstr, &vcomp);
|
4359
|
+
rb_scan_args(argc, argv, "11:", &vstr, &vcomp, &opt);
|
4360
|
+
if (!NIL_P(opt)) argc--;
|
4361
|
+
check_limit(vstr, opt);
|
4333
4362
|
StringValue(vstr);
|
4334
4363
|
if (!rb_enc_str_asciicompat_p(vstr))
|
4335
4364
|
rb_raise(rb_eArgError,
|
@@ -4344,12 +4373,12 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
|
4344
4373
|
|
4345
4374
|
/*
|
4346
4375
|
* call-seq:
|
4347
|
-
* Date._parse(string[, comp=true]) -> hash
|
4376
|
+
* Date._parse(string[, comp=true], limit: 128) -> hash
|
4348
4377
|
*
|
4349
4378
|
* Parses the given representation of date and time, and returns a
|
4350
4379
|
* hash of parsed elements.
|
4351
4380
|
*
|
4352
|
-
* This method
|
4381
|
+
* This method *does not* function as a validator. If the input
|
4353
4382
|
* string does not match valid formats strictly, you may get a cryptic
|
4354
4383
|
* result. Should consider to use `Date._strptime` or
|
4355
4384
|
* `DateTime._strptime` instead of this method as possible.
|
@@ -4359,6 +4388,10 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
|
4359
4388
|
* it full.
|
4360
4389
|
*
|
4361
4390
|
* Date._parse('2001-02-03') #=> {:year=>2001, :mon=>2, :mday=>3}
|
4391
|
+
*
|
4392
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4393
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4394
|
+
* it may take a long time to parse.
|
4362
4395
|
*/
|
4363
4396
|
static VALUE
|
4364
4397
|
date_s__parse(int argc, VALUE *argv, VALUE klass)
|
@@ -4368,12 +4401,12 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
|
|
4368
4401
|
|
4369
4402
|
/*
|
4370
4403
|
* call-seq:
|
4371
|
-
* Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]]) -> date
|
4404
|
+
* Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]], limit: 128) -> date
|
4372
4405
|
*
|
4373
4406
|
* Parses the given representation of date and time, and creates a
|
4374
4407
|
* date object.
|
4375
4408
|
*
|
4376
|
-
* This method
|
4409
|
+
* This method *does not* function as a validator. If the input
|
4377
4410
|
* string does not match valid formats strictly, you may get a cryptic
|
4378
4411
|
* result. Should consider to use `Date.strptime` instead of this
|
4379
4412
|
* method as possible.
|
@@ -4385,13 +4418,18 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
|
|
4385
4418
|
* Date.parse('2001-02-03') #=> #<Date: 2001-02-03 ...>
|
4386
4419
|
* Date.parse('20010203') #=> #<Date: 2001-02-03 ...>
|
4387
4420
|
* Date.parse('3rd Feb 2001') #=> #<Date: 2001-02-03 ...>
|
4421
|
+
*
|
4422
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4423
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4424
|
+
* it may take a long time to parse.
|
4388
4425
|
*/
|
4389
4426
|
static VALUE
|
4390
4427
|
date_s_parse(int argc, VALUE *argv, VALUE klass)
|
4391
4428
|
{
|
4392
|
-
VALUE str, comp, sg;
|
4429
|
+
VALUE str, comp, sg, opt;
|
4393
4430
|
|
4394
|
-
rb_scan_args(argc, argv, "03", &str, &comp, &sg);
|
4431
|
+
rb_scan_args(argc, argv, "03:", &str, &comp, &sg, &opt);
|
4432
|
+
if (!NIL_P(opt)) argc--;
|
4395
4433
|
|
4396
4434
|
switch (argc) {
|
4397
4435
|
case 0:
|
@@ -4403,11 +4441,12 @@ date_s_parse(int argc, VALUE *argv, VALUE klass)
|
|
4403
4441
|
}
|
4404
4442
|
|
4405
4443
|
{
|
4406
|
-
|
4407
|
-
|
4408
|
-
|
4409
|
-
|
4410
|
-
|
4444
|
+
int argc2 = 2;
|
4445
|
+
VALUE argv2[3];
|
4446
|
+
argv2[0] = str;
|
4447
|
+
argv2[1] = comp;
|
4448
|
+
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4449
|
+
VALUE hash = date_s__parse(argc2, argv2, klass);
|
4411
4450
|
return d_new_by_frags(klass, hash, sg);
|
4412
4451
|
}
|
4413
4452
|
}
|
@@ -4421,19 +4460,28 @@ VALUE date__jisx0301(VALUE);
|
|
4421
4460
|
|
4422
4461
|
/*
|
4423
4462
|
* call-seq:
|
4424
|
-
* Date._iso8601(string) -> hash
|
4463
|
+
* Date._iso8601(string, limit: 128) -> hash
|
4425
4464
|
*
|
4426
4465
|
* Returns a hash of parsed elements.
|
4466
|
+
*
|
4467
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4468
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4469
|
+
* it may take a long time to parse.
|
4427
4470
|
*/
|
4428
4471
|
static VALUE
|
4429
|
-
date_s__iso8601(VALUE
|
4472
|
+
date_s__iso8601(int argc, VALUE *argv, VALUE klass)
|
4430
4473
|
{
|
4474
|
+
VALUE str, opt;
|
4475
|
+
|
4476
|
+
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4477
|
+
check_limit(str, opt);
|
4478
|
+
|
4431
4479
|
return date__iso8601(str);
|
4432
4480
|
}
|
4433
4481
|
|
4434
4482
|
/*
|
4435
4483
|
* call-seq:
|
4436
|
-
* Date.iso8601(string='-4712-01-01'[, start=Date::ITALY]) -> date
|
4484
|
+
* Date.iso8601(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date
|
4437
4485
|
*
|
4438
4486
|
* Creates a new Date object by parsing from a string according to
|
4439
4487
|
* some typical ISO 8601 formats.
|
@@ -4441,13 +4489,18 @@ date_s__iso8601(VALUE klass, VALUE str)
|
|
4441
4489
|
* Date.iso8601('2001-02-03') #=> #<Date: 2001-02-03 ...>
|
4442
4490
|
* Date.iso8601('20010203') #=> #<Date: 2001-02-03 ...>
|
4443
4491
|
* Date.iso8601('2001-W05-6') #=> #<Date: 2001-02-03 ...>
|
4492
|
+
*
|
4493
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4494
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4495
|
+
* it may take a long time to parse.
|
4444
4496
|
*/
|
4445
4497
|
static VALUE
|
4446
4498
|
date_s_iso8601(int argc, VALUE *argv, VALUE klass)
|
4447
4499
|
{
|
4448
|
-
VALUE str, sg;
|
4500
|
+
VALUE str, sg, opt;
|
4449
4501
|
|
4450
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
4502
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
4503
|
+
if (!NIL_P(opt)) argc--;
|
4451
4504
|
|
4452
4505
|
switch (argc) {
|
4453
4506
|
case 0:
|
@@ -4457,38 +4510,56 @@ date_s_iso8601(int argc, VALUE *argv, VALUE klass)
|
|
4457
4510
|
}
|
4458
4511
|
|
4459
4512
|
{
|
4460
|
-
|
4513
|
+
int argc2 = 1;
|
4514
|
+
VALUE argv2[2];
|
4515
|
+
argv2[0] = str;
|
4516
|
+
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4517
|
+
VALUE hash = date_s__iso8601(argc2, argv2, klass);
|
4461
4518
|
return d_new_by_frags(klass, hash, sg);
|
4462
4519
|
}
|
4463
4520
|
}
|
4464
4521
|
|
4465
4522
|
/*
|
4466
4523
|
* call-seq:
|
4467
|
-
* Date._rfc3339(string) -> hash
|
4524
|
+
* Date._rfc3339(string, limit: 128) -> hash
|
4468
4525
|
*
|
4469
4526
|
* Returns a hash of parsed elements.
|
4527
|
+
*
|
4528
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4529
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4530
|
+
* it may take a long time to parse.
|
4470
4531
|
*/
|
4471
4532
|
static VALUE
|
4472
|
-
date_s__rfc3339(VALUE
|
4533
|
+
date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
|
4473
4534
|
{
|
4535
|
+
VALUE str, opt;
|
4536
|
+
|
4537
|
+
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4538
|
+
check_limit(str, opt);
|
4539
|
+
|
4474
4540
|
return date__rfc3339(str);
|
4475
4541
|
}
|
4476
4542
|
|
4477
4543
|
/*
|
4478
4544
|
* call-seq:
|
4479
|
-
* Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> date
|
4545
|
+
* Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> date
|
4480
4546
|
*
|
4481
4547
|
* Creates a new Date object by parsing from a string according to
|
4482
4548
|
* some typical RFC 3339 formats.
|
4483
4549
|
*
|
4484
4550
|
* Date.rfc3339('2001-02-03T04:05:06+07:00') #=> #<Date: 2001-02-03 ...>
|
4551
|
+
*
|
4552
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4553
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4554
|
+
* it may take a long time to parse.
|
4485
4555
|
*/
|
4486
4556
|
static VALUE
|
4487
4557
|
date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
|
4488
4558
|
{
|
4489
|
-
VALUE str, sg;
|
4559
|
+
VALUE str, sg, opt;
|
4490
4560
|
|
4491
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
4561
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
4562
|
+
if (!NIL_P(opt)) argc--;
|
4492
4563
|
|
4493
4564
|
switch (argc) {
|
4494
4565
|
case 0:
|
@@ -4498,38 +4569,56 @@ date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
|
|
4498
4569
|
}
|
4499
4570
|
|
4500
4571
|
{
|
4501
|
-
|
4572
|
+
int argc2 = 1;
|
4573
|
+
VALUE argv2[2];
|
4574
|
+
argv2[0] = str;
|
4575
|
+
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4576
|
+
VALUE hash = date_s__rfc3339(argc2, argv2, klass);
|
4502
4577
|
return d_new_by_frags(klass, hash, sg);
|
4503
4578
|
}
|
4504
4579
|
}
|
4505
4580
|
|
4506
4581
|
/*
|
4507
4582
|
* call-seq:
|
4508
|
-
* Date._xmlschema(string) -> hash
|
4583
|
+
* Date._xmlschema(string, limit: 128) -> hash
|
4509
4584
|
*
|
4510
4585
|
* Returns a hash of parsed elements.
|
4586
|
+
*
|
4587
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4588
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4589
|
+
* it may take a long time to parse.
|
4511
4590
|
*/
|
4512
4591
|
static VALUE
|
4513
|
-
date_s__xmlschema(VALUE
|
4592
|
+
date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
|
4514
4593
|
{
|
4594
|
+
VALUE str, opt;
|
4595
|
+
|
4596
|
+
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4597
|
+
check_limit(str, opt);
|
4598
|
+
|
4515
4599
|
return date__xmlschema(str);
|
4516
4600
|
}
|
4517
4601
|
|
4518
4602
|
/*
|
4519
4603
|
* call-seq:
|
4520
|
-
* Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY]) -> date
|
4604
|
+
* Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date
|
4521
4605
|
*
|
4522
4606
|
* Creates a new Date object by parsing from a string according to
|
4523
4607
|
* some typical XML Schema formats.
|
4524
4608
|
*
|
4525
4609
|
* Date.xmlschema('2001-02-03') #=> #<Date: 2001-02-03 ...>
|
4610
|
+
*
|
4611
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4612
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4613
|
+
* it may take a long time to parse.
|
4526
4614
|
*/
|
4527
4615
|
static VALUE
|
4528
4616
|
date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
|
4529
4617
|
{
|
4530
|
-
VALUE str, sg;
|
4618
|
+
VALUE str, sg, opt;
|
4531
4619
|
|
4532
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
4620
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
4621
|
+
if (!NIL_P(opt)) argc--;
|
4533
4622
|
|
4534
4623
|
switch (argc) {
|
4535
4624
|
case 0:
|
@@ -4539,41 +4628,58 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
|
|
4539
4628
|
}
|
4540
4629
|
|
4541
4630
|
{
|
4542
|
-
|
4631
|
+
int argc2 = 1;
|
4632
|
+
VALUE argv2[2];
|
4633
|
+
argv2[0] = str;
|
4634
|
+
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4635
|
+
VALUE hash = date_s__xmlschema(argc2, argv2, klass);
|
4543
4636
|
return d_new_by_frags(klass, hash, sg);
|
4544
4637
|
}
|
4545
4638
|
}
|
4546
4639
|
|
4547
4640
|
/*
|
4548
4641
|
* call-seq:
|
4549
|
-
* Date._rfc2822(string) -> hash
|
4550
|
-
* Date._rfc822(string) -> hash
|
4642
|
+
* Date._rfc2822(string, limit: 128) -> hash
|
4643
|
+
* Date._rfc822(string, limit: 128) -> hash
|
4551
4644
|
*
|
4552
4645
|
* Returns a hash of parsed elements.
|
4646
|
+
*
|
4647
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4648
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4649
|
+
* it may take a long time to parse.
|
4553
4650
|
*/
|
4554
4651
|
static VALUE
|
4555
|
-
date_s__rfc2822(VALUE
|
4652
|
+
date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
|
4556
4653
|
{
|
4654
|
+
VALUE str, opt;
|
4655
|
+
|
4656
|
+
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4657
|
+
check_limit(str, opt);
|
4658
|
+
|
4557
4659
|
return date__rfc2822(str);
|
4558
4660
|
}
|
4559
4661
|
|
4560
4662
|
/*
|
4561
4663
|
* call-seq:
|
4562
|
-
* Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date
|
4563
|
-
* Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date
|
4664
|
+
* Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date
|
4665
|
+
* Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date
|
4564
4666
|
*
|
4565
4667
|
* Creates a new Date object by parsing from a string according to
|
4566
4668
|
* some typical RFC 2822 formats.
|
4567
4669
|
*
|
4568
4670
|
* Date.rfc2822('Sat, 3 Feb 2001 00:00:00 +0000')
|
4569
4671
|
* #=> #<Date: 2001-02-03 ...>
|
4672
|
+
*
|
4673
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4674
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4675
|
+
* it may take a long time to parse.
|
4570
4676
|
*/
|
4571
4677
|
static VALUE
|
4572
4678
|
date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
4573
4679
|
{
|
4574
|
-
VALUE str, sg;
|
4680
|
+
VALUE str, sg, opt;
|
4575
4681
|
|
4576
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
4682
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
4577
4683
|
|
4578
4684
|
switch (argc) {
|
4579
4685
|
case 0:
|
@@ -4583,39 +4689,56 @@ date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
|
4583
4689
|
}
|
4584
4690
|
|
4585
4691
|
{
|
4586
|
-
|
4692
|
+
int argc2 = 1;
|
4693
|
+
VALUE argv2[2];
|
4694
|
+
argv2[0] = str;
|
4695
|
+
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4696
|
+
VALUE hash = date_s__rfc2822(argc2, argv2, klass);
|
4587
4697
|
return d_new_by_frags(klass, hash, sg);
|
4588
4698
|
}
|
4589
4699
|
}
|
4590
4700
|
|
4591
4701
|
/*
|
4592
4702
|
* call-seq:
|
4593
|
-
* Date._httpdate(string) -> hash
|
4703
|
+
* Date._httpdate(string, limit: 128) -> hash
|
4594
4704
|
*
|
4595
4705
|
* Returns a hash of parsed elements.
|
4706
|
+
*
|
4707
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4708
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4709
|
+
* it may take a long time to parse.
|
4596
4710
|
*/
|
4597
4711
|
static VALUE
|
4598
|
-
date_s__httpdate(VALUE
|
4712
|
+
date_s__httpdate(int argc, VALUE *argv, VALUE klass)
|
4599
4713
|
{
|
4714
|
+
VALUE str, opt;
|
4715
|
+
|
4716
|
+
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4717
|
+
check_limit(str, opt);
|
4718
|
+
|
4600
4719
|
return date__httpdate(str);
|
4601
4720
|
}
|
4602
4721
|
|
4603
4722
|
/*
|
4604
4723
|
* call-seq:
|
4605
|
-
* Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY]) -> date
|
4724
|
+
* Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY], limit: 128) -> date
|
4606
4725
|
*
|
4607
4726
|
* Creates a new Date object by parsing from a string according to
|
4608
4727
|
* some RFC 2616 format.
|
4609
4728
|
*
|
4610
4729
|
* Date.httpdate('Sat, 03 Feb 2001 00:00:00 GMT')
|
4611
4730
|
* #=> #<Date: 2001-02-03 ...>
|
4731
|
+
*
|
4732
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4733
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4734
|
+
* it may take a long time to parse.
|
4612
4735
|
*/
|
4613
4736
|
static VALUE
|
4614
4737
|
date_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
4615
4738
|
{
|
4616
|
-
VALUE str, sg;
|
4739
|
+
VALUE str, sg, opt;
|
4617
4740
|
|
4618
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
4741
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
4619
4742
|
|
4620
4743
|
switch (argc) {
|
4621
4744
|
case 0:
|
@@ -4625,26 +4748,39 @@ date_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
|
4625
4748
|
}
|
4626
4749
|
|
4627
4750
|
{
|
4628
|
-
|
4751
|
+
int argc2 = 1;
|
4752
|
+
VALUE argv2[2];
|
4753
|
+
argv2[0] = str;
|
4754
|
+
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4755
|
+
VALUE hash = date_s__httpdate(argc2, argv2, klass);
|
4629
4756
|
return d_new_by_frags(klass, hash, sg);
|
4630
4757
|
}
|
4631
4758
|
}
|
4632
4759
|
|
4633
4760
|
/*
|
4634
4761
|
* call-seq:
|
4635
|
-
* Date._jisx0301(string) -> hash
|
4762
|
+
* Date._jisx0301(string, limit: 128) -> hash
|
4636
4763
|
*
|
4637
4764
|
* Returns a hash of parsed elements.
|
4765
|
+
*
|
4766
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4767
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4768
|
+
* it may take a long time to parse.
|
4638
4769
|
*/
|
4639
4770
|
static VALUE
|
4640
|
-
date_s__jisx0301(VALUE
|
4771
|
+
date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
|
4641
4772
|
{
|
4773
|
+
VALUE str, opt;
|
4774
|
+
|
4775
|
+
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4776
|
+
check_limit(str, opt);
|
4777
|
+
|
4642
4778
|
return date__jisx0301(str);
|
4643
4779
|
}
|
4644
4780
|
|
4645
4781
|
/*
|
4646
4782
|
* call-seq:
|
4647
|
-
* Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY]) -> date
|
4783
|
+
* Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date
|
4648
4784
|
*
|
4649
4785
|
* Creates a new Date object by parsing from a string according to
|
4650
4786
|
* some typical JIS X 0301 formats.
|
@@ -4654,13 +4790,18 @@ date_s__jisx0301(VALUE klass, VALUE str)
|
|
4654
4790
|
* For no-era year, legacy format, Heisei is assumed.
|
4655
4791
|
*
|
4656
4792
|
* Date.jisx0301('13.02.03') #=> #<Date: 2001-02-03 ...>
|
4793
|
+
*
|
4794
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
4795
|
+
* You can stop this check by passing `limit: nil`, but note that
|
4796
|
+
* it may take a long time to parse.
|
4657
4797
|
*/
|
4658
4798
|
static VALUE
|
4659
4799
|
date_s_jisx0301(int argc, VALUE *argv, VALUE klass)
|
4660
4800
|
{
|
4661
|
-
VALUE str, sg;
|
4801
|
+
VALUE str, sg, opt;
|
4662
4802
|
|
4663
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
4803
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
4804
|
+
if (!NIL_P(opt)) argc--;
|
4664
4805
|
|
4665
4806
|
switch (argc) {
|
4666
4807
|
case 0:
|
@@ -4670,7 +4811,11 @@ date_s_jisx0301(int argc, VALUE *argv, VALUE klass)
|
|
4670
4811
|
}
|
4671
4812
|
|
4672
4813
|
{
|
4673
|
-
|
4814
|
+
int argc2 = 1;
|
4815
|
+
VALUE argv2[2];
|
4816
|
+
argv2[0] = str;
|
4817
|
+
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4818
|
+
VALUE hash = date_s__jisx0301(argc2, argv2, klass);
|
4674
4819
|
return d_new_by_frags(klass, hash, sg);
|
4675
4820
|
}
|
4676
4821
|
}
|
@@ -6896,7 +7041,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
|
|
6896
7041
|
* %c - date and time (%a %b %e %T %Y)
|
6897
7042
|
* %D - Date (%m/%d/%y)
|
6898
7043
|
* %F - The ISO 8601 date format (%Y-%m-%d)
|
6899
|
-
* %v - VMS date (%e
|
7044
|
+
* %v - VMS date (%e-%^b-%Y)
|
6900
7045
|
* %x - Same as %D
|
6901
7046
|
* %X - Same as %T
|
6902
7047
|
* %r - 12-hour time (%I:%M:%S %p)
|
@@ -7793,7 +7938,7 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass)
|
|
7793
7938
|
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
|
7794
7939
|
of = tm.tm_gmtoff;
|
7795
7940
|
#elif defined(HAVE_TIMEZONE)
|
7796
|
-
#
|
7941
|
+
#if defined(HAVE_ALTZONE) && !defined(_AIX)
|
7797
7942
|
of = (long)-((tm.tm_isdst > 0) ? altzone : timezone);
|
7798
7943
|
#else
|
7799
7944
|
of = (long)-timezone;
|
@@ -8009,12 +8154,12 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
|
|
8009
8154
|
|
8010
8155
|
/*
|
8011
8156
|
* call-seq:
|
8012
|
-
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]]) -> datetime
|
8157
|
+
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]], limit: 128) -> datetime
|
8013
8158
|
*
|
8014
8159
|
* Parses the given representation of date and time, and creates a
|
8015
8160
|
* DateTime object.
|
8016
8161
|
*
|
8017
|
-
* This method
|
8162
|
+
* This method *does not* function as a validator. If the input
|
8018
8163
|
* string does not match valid formats strictly, you may get a cryptic
|
8019
8164
|
* result. Should consider to use `DateTime.strptime` instead of this
|
8020
8165
|
* method as possible.
|
@@ -8028,13 +8173,18 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
|
|
8028
8173
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8029
8174
|
* DateTime.parse('3rd Feb 2001 04:05:06 PM')
|
8030
8175
|
* #=> #<DateTime: 2001-02-03T16:05:06+00:00 ...>
|
8176
|
+
*
|
8177
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
8178
|
+
* You can stop this check by passing `limit: nil`, but note that
|
8179
|
+
* it may take a long time to parse.
|
8031
8180
|
*/
|
8032
8181
|
static VALUE
|
8033
8182
|
datetime_s_parse(int argc, VALUE *argv, VALUE klass)
|
8034
8183
|
{
|
8035
|
-
VALUE str, comp, sg;
|
8184
|
+
VALUE str, comp, sg, opt;
|
8036
8185
|
|
8037
|
-
rb_scan_args(argc, argv, "03", &str, &comp, &sg);
|
8186
|
+
rb_scan_args(argc, argv, "03:", &str, &comp, &sg, &opt);
|
8187
|
+
if (!NIL_P(opt)) argc--;
|
8038
8188
|
|
8039
8189
|
switch (argc) {
|
8040
8190
|
case 0:
|
@@ -8046,18 +8196,20 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass)
|
|
8046
8196
|
}
|
8047
8197
|
|
8048
8198
|
{
|
8049
|
-
|
8050
|
-
|
8051
|
-
|
8052
|
-
|
8053
|
-
|
8199
|
+
int argc2 = 2;
|
8200
|
+
VALUE argv2[3];
|
8201
|
+
argv2[0] = str;
|
8202
|
+
argv2[1] = comp;
|
8203
|
+
argv2[2] = opt;
|
8204
|
+
if (!NIL_P(opt)) argc2++;
|
8205
|
+
VALUE hash = date_s__parse(argc2, argv2, klass);
|
8054
8206
|
return dt_new_by_frags(klass, hash, sg);
|
8055
8207
|
}
|
8056
8208
|
}
|
8057
8209
|
|
8058
8210
|
/*
|
8059
8211
|
* call-seq:
|
8060
|
-
* DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
8212
|
+
* DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime
|
8061
8213
|
*
|
8062
8214
|
* Creates a new DateTime object by parsing from a string according to
|
8063
8215
|
* some typical ISO 8601 formats.
|
@@ -8068,13 +8220,18 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass)
|
|
8068
8220
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8069
8221
|
* DateTime.iso8601('2001-W05-6T04:05:06+07:00')
|
8070
8222
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8223
|
+
*
|
8224
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
8225
|
+
* You can stop this check by passing `limit: nil`, but note that
|
8226
|
+
* it may take a long time to parse.
|
8071
8227
|
*/
|
8072
8228
|
static VALUE
|
8073
8229
|
datetime_s_iso8601(int argc, VALUE *argv, VALUE klass)
|
8074
8230
|
{
|
8075
|
-
VALUE str, sg;
|
8231
|
+
VALUE str, sg, opt;
|
8076
8232
|
|
8077
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
8233
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
8234
|
+
if (!NIL_P(opt)) argc--;
|
8078
8235
|
|
8079
8236
|
switch (argc) {
|
8080
8237
|
case 0:
|
@@ -8084,27 +8241,37 @@ datetime_s_iso8601(int argc, VALUE *argv, VALUE klass)
|
|
8084
8241
|
}
|
8085
8242
|
|
8086
8243
|
{
|
8087
|
-
|
8244
|
+
int argc2 = 1;
|
8245
|
+
VALUE argv2[2];
|
8246
|
+
argv2[0] = str;
|
8247
|
+
argv2[1] = opt;
|
8248
|
+
if (!NIL_P(opt)) argc2--;
|
8249
|
+
VALUE hash = date_s__iso8601(argc2, argv2, klass);
|
8088
8250
|
return dt_new_by_frags(klass, hash, sg);
|
8089
8251
|
}
|
8090
8252
|
}
|
8091
8253
|
|
8092
8254
|
/*
|
8093
8255
|
* call-seq:
|
8094
|
-
* DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
8256
|
+
* DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime
|
8095
8257
|
*
|
8096
8258
|
* Creates a new DateTime object by parsing from a string according to
|
8097
8259
|
* some typical RFC 3339 formats.
|
8098
8260
|
*
|
8099
8261
|
* DateTime.rfc3339('2001-02-03T04:05:06+07:00')
|
8100
8262
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8263
|
+
*
|
8264
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
8265
|
+
* You can stop this check by passing `limit: nil`, but note that
|
8266
|
+
* it may take a long time to parse.
|
8101
8267
|
*/
|
8102
8268
|
static VALUE
|
8103
8269
|
datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass)
|
8104
8270
|
{
|
8105
|
-
VALUE str, sg;
|
8271
|
+
VALUE str, sg, opt;
|
8106
8272
|
|
8107
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
8273
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
8274
|
+
if (!NIL_P(opt)) argc--;
|
8108
8275
|
|
8109
8276
|
switch (argc) {
|
8110
8277
|
case 0:
|
@@ -8114,27 +8281,37 @@ datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass)
|
|
8114
8281
|
}
|
8115
8282
|
|
8116
8283
|
{
|
8117
|
-
|
8284
|
+
int argc2 = 1;
|
8285
|
+
VALUE argv2[2];
|
8286
|
+
argv2[0] = str;
|
8287
|
+
argv2[1] = opt;
|
8288
|
+
if (!NIL_P(opt)) argc2++;
|
8289
|
+
VALUE hash = date_s__rfc3339(argc2, argv2, klass);
|
8118
8290
|
return dt_new_by_frags(klass, hash, sg);
|
8119
8291
|
}
|
8120
8292
|
}
|
8121
8293
|
|
8122
8294
|
/*
|
8123
8295
|
* call-seq:
|
8124
|
-
* DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
8296
|
+
* DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime
|
8125
8297
|
*
|
8126
8298
|
* Creates a new DateTime object by parsing from a string according to
|
8127
8299
|
* some typical XML Schema formats.
|
8128
8300
|
*
|
8129
8301
|
* DateTime.xmlschema('2001-02-03T04:05:06+07:00')
|
8130
8302
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8303
|
+
*
|
8304
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
8305
|
+
* You can stop this check by passing `limit: nil`, but note that
|
8306
|
+
* it may take a long time to parse.
|
8131
8307
|
*/
|
8132
8308
|
static VALUE
|
8133
8309
|
datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass)
|
8134
8310
|
{
|
8135
|
-
VALUE str, sg;
|
8311
|
+
VALUE str, sg, opt;
|
8136
8312
|
|
8137
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
8313
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
8314
|
+
if (!NIL_P(opt)) argc--;
|
8138
8315
|
|
8139
8316
|
switch (argc) {
|
8140
8317
|
case 0:
|
@@ -8144,28 +8321,38 @@ datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass)
|
|
8144
8321
|
}
|
8145
8322
|
|
8146
8323
|
{
|
8147
|
-
|
8324
|
+
int argc2 = 1;
|
8325
|
+
VALUE argv2[2];
|
8326
|
+
argv2[0] = str;
|
8327
|
+
argv2[1] = opt;
|
8328
|
+
if (!NIL_P(opt)) argc2++;
|
8329
|
+
VALUE hash = date_s__xmlschema(argc2, argv2, klass);
|
8148
8330
|
return dt_new_by_frags(klass, hash, sg);
|
8149
8331
|
}
|
8150
8332
|
}
|
8151
8333
|
|
8152
8334
|
/*
|
8153
8335
|
* call-seq:
|
8154
|
-
* DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> datetime
|
8155
|
-
* DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> datetime
|
8336
|
+
* DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> datetime
|
8337
|
+
* DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> datetime
|
8156
8338
|
*
|
8157
8339
|
* Creates a new DateTime object by parsing from a string according to
|
8158
8340
|
* some typical RFC 2822 formats.
|
8159
8341
|
*
|
8160
8342
|
* DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700')
|
8161
8343
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8344
|
+
*
|
8345
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
8346
|
+
* You can stop this check by passing `limit: nil`, but note that
|
8347
|
+
* it may take a long time to parse.
|
8162
8348
|
*/
|
8163
8349
|
static VALUE
|
8164
8350
|
datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
8165
8351
|
{
|
8166
|
-
VALUE str, sg;
|
8352
|
+
VALUE str, sg, opt;
|
8167
8353
|
|
8168
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
8354
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
8355
|
+
if (!NIL_P(opt)) argc--;
|
8169
8356
|
|
8170
8357
|
switch (argc) {
|
8171
8358
|
case 0:
|
@@ -8175,7 +8362,12 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
|
8175
8362
|
}
|
8176
8363
|
|
8177
8364
|
{
|
8178
|
-
|
8365
|
+
int argc2 = 1;
|
8366
|
+
VALUE argv2[2];
|
8367
|
+
argv2[0] = str;
|
8368
|
+
argv2[1] = opt;
|
8369
|
+
if (!NIL_P(opt)) argc2++;
|
8370
|
+
VALUE hash = date_s__rfc2822(argc2, argv2, klass);
|
8179
8371
|
return dt_new_by_frags(klass, hash, sg);
|
8180
8372
|
}
|
8181
8373
|
}
|
@@ -8189,13 +8381,18 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
|
8189
8381
|
*
|
8190
8382
|
* DateTime.httpdate('Sat, 03 Feb 2001 04:05:06 GMT')
|
8191
8383
|
* #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...>
|
8384
|
+
*
|
8385
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
8386
|
+
* You can stop this check by passing `limit: nil`, but note that
|
8387
|
+
* it may take a long time to parse.
|
8192
8388
|
*/
|
8193
8389
|
static VALUE
|
8194
8390
|
datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
8195
8391
|
{
|
8196
|
-
VALUE str, sg;
|
8392
|
+
VALUE str, sg, opt;
|
8197
8393
|
|
8198
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
8394
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
8395
|
+
if (!NIL_P(opt)) argc--;
|
8199
8396
|
|
8200
8397
|
switch (argc) {
|
8201
8398
|
case 0:
|
@@ -8205,14 +8402,19 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
|
8205
8402
|
}
|
8206
8403
|
|
8207
8404
|
{
|
8208
|
-
|
8405
|
+
int argc2 = 1;
|
8406
|
+
VALUE argv2[2];
|
8407
|
+
argv2[0] = str;
|
8408
|
+
argv2[1] = opt;
|
8409
|
+
if (!NIL_P(opt)) argc2++;
|
8410
|
+
VALUE hash = date_s__httpdate(argc2, argv2, klass);
|
8209
8411
|
return dt_new_by_frags(klass, hash, sg);
|
8210
8412
|
}
|
8211
8413
|
}
|
8212
8414
|
|
8213
8415
|
/*
|
8214
8416
|
* call-seq:
|
8215
|
-
* DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
8417
|
+
* DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime
|
8216
8418
|
*
|
8217
8419
|
* Creates a new DateTime object by parsing from a string according to
|
8218
8420
|
* some typical JIS X 0301 formats.
|
@@ -8224,13 +8426,18 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
|
8224
8426
|
*
|
8225
8427
|
* DateTime.jisx0301('13.02.03T04:05:06+07:00')
|
8226
8428
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8429
|
+
*
|
8430
|
+
* Raise an ArgumentError when the string length is longer than _limit_.
|
8431
|
+
* You can stop this check by passing `limit: nil`, but note that
|
8432
|
+
* it may take a long time to parse.
|
8227
8433
|
*/
|
8228
8434
|
static VALUE
|
8229
8435
|
datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass)
|
8230
8436
|
{
|
8231
|
-
VALUE str, sg;
|
8437
|
+
VALUE str, sg, opt;
|
8232
8438
|
|
8233
|
-
rb_scan_args(argc, argv, "02", &str, &sg);
|
8439
|
+
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
|
8440
|
+
if (!NIL_P(opt)) argc--;
|
8234
8441
|
|
8235
8442
|
switch (argc) {
|
8236
8443
|
case 0:
|
@@ -8240,7 +8447,12 @@ datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass)
|
|
8240
8447
|
}
|
8241
8448
|
|
8242
8449
|
{
|
8243
|
-
|
8450
|
+
int argc2 = 1;
|
8451
|
+
VALUE argv2[2];
|
8452
|
+
argv2[0] = str;
|
8453
|
+
argv2[1] = opt;
|
8454
|
+
if (!NIL_P(opt)) argc2++;
|
8455
|
+
VALUE hash = date_s__jisx0301(argc2, argv2, klass);
|
8244
8456
|
return dt_new_by_frags(klass, hash, sg);
|
8245
8457
|
}
|
8246
8458
|
}
|
@@ -8376,7 +8588,7 @@ dt_lite_to_s(VALUE self)
|
|
8376
8588
|
* %c - date and time (%a %b %e %T %Y)
|
8377
8589
|
* %D - Date (%m/%d/%y)
|
8378
8590
|
* %F - The ISO 8601 date format (%Y-%m-%d)
|
8379
|
-
* %v - VMS date (%e
|
8591
|
+
* %v - VMS date (%e-%^b-%Y)
|
8380
8592
|
* %x - Same as %D
|
8381
8593
|
* %X - Same as %T
|
8382
8594
|
* %r - 12-hour time (%I:%M:%S %p)
|
@@ -9399,19 +9611,19 @@ Init_date_core(void)
|
|
9399
9611
|
rb_define_singleton_method(cDate, "strptime", date_s_strptime, -1);
|
9400
9612
|
rb_define_singleton_method(cDate, "_parse", date_s__parse, -1);
|
9401
9613
|
rb_define_singleton_method(cDate, "parse", date_s_parse, -1);
|
9402
|
-
rb_define_singleton_method(cDate, "_iso8601", date_s__iso8601, 1);
|
9614
|
+
rb_define_singleton_method(cDate, "_iso8601", date_s__iso8601, -1);
|
9403
9615
|
rb_define_singleton_method(cDate, "iso8601", date_s_iso8601, -1);
|
9404
|
-
rb_define_singleton_method(cDate, "_rfc3339", date_s__rfc3339, 1);
|
9616
|
+
rb_define_singleton_method(cDate, "_rfc3339", date_s__rfc3339, -1);
|
9405
9617
|
rb_define_singleton_method(cDate, "rfc3339", date_s_rfc3339, -1);
|
9406
|
-
rb_define_singleton_method(cDate, "_xmlschema", date_s__xmlschema, 1);
|
9618
|
+
rb_define_singleton_method(cDate, "_xmlschema", date_s__xmlschema, -1);
|
9407
9619
|
rb_define_singleton_method(cDate, "xmlschema", date_s_xmlschema, -1);
|
9408
|
-
rb_define_singleton_method(cDate, "_rfc2822", date_s__rfc2822, 1);
|
9409
|
-
rb_define_singleton_method(cDate, "_rfc822", date_s__rfc2822, 1);
|
9620
|
+
rb_define_singleton_method(cDate, "_rfc2822", date_s__rfc2822, -1);
|
9621
|
+
rb_define_singleton_method(cDate, "_rfc822", date_s__rfc2822, -1);
|
9410
9622
|
rb_define_singleton_method(cDate, "rfc2822", date_s_rfc2822, -1);
|
9411
9623
|
rb_define_singleton_method(cDate, "rfc822", date_s_rfc2822, -1);
|
9412
|
-
rb_define_singleton_method(cDate, "_httpdate", date_s__httpdate, 1);
|
9624
|
+
rb_define_singleton_method(cDate, "_httpdate", date_s__httpdate, -1);
|
9413
9625
|
rb_define_singleton_method(cDate, "httpdate", date_s_httpdate, -1);
|
9414
|
-
rb_define_singleton_method(cDate, "_jisx0301", date_s__jisx0301, 1);
|
9626
|
+
rb_define_singleton_method(cDate, "_jisx0301", date_s__jisx0301, -1);
|
9415
9627
|
rb_define_singleton_method(cDate, "jisx0301", date_s_jisx0301, -1);
|
9416
9628
|
|
9417
9629
|
rb_define_method(cDate, "initialize", date_initialize, -1);
|
data/ext/date/date_strftime.c
CHANGED
data/ext/date/extconf.rb
CHANGED
@@ -3,7 +3,9 @@ require 'mkmf'
|
|
3
3
|
|
4
4
|
config_string("strict_warnflags") {|w| $warnflags += " #{w}"}
|
5
5
|
|
6
|
-
|
7
|
-
have_var("
|
6
|
+
with_werror("", {:werror => true}) do |opt, |
|
7
|
+
have_var("timezone", "time.h", opt)
|
8
|
+
have_var("altzone", "time.h", opt)
|
9
|
+
end
|
8
10
|
|
9
11
|
create_makefile('date_core')
|
data/ext/date/prereq.mk
CHANGED
data/ext/date/zonetab.h
CHANGED
@@ -846,7 +846,7 @@ zonetab (register const char *str, register size_t len)
|
|
846
846
|
{gperf_offsetof(stringpool, 22), 3*3600},
|
847
847
|
{-1},
|
848
848
|
#line 101 "zonetab.list"
|
849
|
-
{gperf_offsetof(stringpool, 24)
|
849
|
+
{gperf_offsetof(stringpool, 24),-6*3600},
|
850
850
|
#line 217 "zonetab.list"
|
851
851
|
{gperf_offsetof(stringpool, 25),-18000},
|
852
852
|
#line 19 "zonetab.list"
|
@@ -875,7 +875,7 @@ zonetab (register const char *str, register size_t len)
|
|
875
875
|
#line 79 "zonetab.list"
|
876
876
|
{gperf_offsetof(stringpool, 38), 2*3600},
|
877
877
|
#line 65 "zonetab.list"
|
878
|
-
{gperf_offsetof(stringpool, 39)
|
878
|
+
{gperf_offsetof(stringpool, 39),2*3600},
|
879
879
|
{-1},
|
880
880
|
#line 202 "zonetab.list"
|
881
881
|
{gperf_offsetof(stringpool, 41),28800},
|
@@ -998,7 +998,7 @@ zonetab (register const char *str, register size_t len)
|
|
998
998
|
#line 148 "zonetab.list"
|
999
999
|
{gperf_offsetof(stringpool, 107), -25200},
|
1000
1000
|
#line 96 "zonetab.list"
|
1001
|
-
{gperf_offsetof(stringpool, 108),
|
1001
|
+
{gperf_offsetof(stringpool, 108), (6*3600+1800)},
|
1002
1002
|
#line 42 "zonetab.list"
|
1003
1003
|
{gperf_offsetof(stringpool, 109), -10*3600},
|
1004
1004
|
#line 31 "zonetab.list"
|
@@ -1017,11 +1017,11 @@ zonetab (register const char *str, register size_t len)
|
|
1017
1017
|
{gperf_offsetof(stringpool, 117), 1*3600},
|
1018
1018
|
{-1},
|
1019
1019
|
#line 95 "zonetab.list"
|
1020
|
-
{gperf_offsetof(stringpool, 119),
|
1020
|
+
{gperf_offsetof(stringpool, 119), 2*3600},
|
1021
1021
|
#line 313 "zonetab.list"
|
1022
1022
|
{gperf_offsetof(stringpool, 120),43200},
|
1023
1023
|
#line 55 "zonetab.list"
|
1024
|
-
{gperf_offsetof(stringpool, 121), -(
|
1024
|
+
{gperf_offsetof(stringpool, 121), -(2*3600+1800)},
|
1025
1025
|
#line 184 "zonetab.list"
|
1026
1026
|
{gperf_offsetof(stringpool, 122),31500},
|
1027
1027
|
#line 204 "zonetab.list"
|
@@ -1168,7 +1168,7 @@ zonetab (register const char *str, register size_t len)
|
|
1168
1168
|
#line 299 "zonetab.list"
|
1169
1169
|
{gperf_offsetof(stringpool, 206),50400},
|
1170
1170
|
#line 85 "zonetab.list"
|
1171
|
-
{gperf_offsetof(stringpool, 207),
|
1171
|
+
{gperf_offsetof(stringpool, 207), -11*3600},
|
1172
1172
|
{-1},
|
1173
1173
|
#line 142 "zonetab.list"
|
1174
1174
|
{gperf_offsetof(stringpool, 209), 19800},
|
@@ -1371,7 +1371,7 @@ zonetab (register const char *str, register size_t len)
|
|
1371
1371
|
{gperf_offsetof(stringpool, 324), 8*3600},
|
1372
1372
|
{-1},
|
1373
1373
|
#line 50 "zonetab.list"
|
1374
|
-
{gperf_offsetof(stringpool, 326), -(
|
1374
|
+
{gperf_offsetof(stringpool, 326), -(1*3600+1800)},
|
1375
1375
|
#line 285 "zonetab.list"
|
1376
1376
|
{gperf_offsetof(stringpool, 327),-10800},
|
1377
1377
|
{-1}, {-1},
|
data/lib/date.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: date
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tadayoshi Funaba
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A subclass of Object includes Comparable module for handling dates.
|
14
14
|
email:
|
15
|
-
-
|
15
|
+
-
|
16
16
|
executables: []
|
17
17
|
extensions:
|
18
18
|
- ext/date/extconf.rb
|
@@ -33,7 +33,7 @@ licenses:
|
|
33
33
|
- Ruby
|
34
34
|
- BSD-2-Clause
|
35
35
|
metadata: {}
|
36
|
-
post_install_message:
|
36
|
+
post_install_message:
|
37
37
|
rdoc_options: []
|
38
38
|
require_paths:
|
39
39
|
- lib
|
@@ -48,8 +48,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
|
-
rubygems_version: 3.
|
52
|
-
signing_key:
|
51
|
+
rubygems_version: 3.1.4
|
52
|
+
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: A subclass of Object includes Comparable module for handling dates.
|
55
55
|
test_files: []
|