date 3.1.3 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of date might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/date/date_core.c +94 -305
- 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 -1
- 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: 3ccbc0063defa6a784459e629b4dc402cdb7c35d7ca51bfbe371ac46210b6b59
|
4
|
+
data.tar.gz: c5c53dd9af2ea3ddb18ff390c9aa5a89370f6fecd068fba64ff425e5ea192d19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be4016ed18b870b75821d2af83d30d79d1530b4f79125a042ccad4b67f9e578ec95313bcdfd2113a995c0281be917d14fe0a9b17200f5a8a15b9672f0b6ca146
|
7
|
+
data.tar.gz: 44898ccbbc5709310ee930c574d07fd4ea897c41934fbf631a401eabe7876145a8e4914d7e8b27d9525414ea112440f1a26e04409fbb3fcbddd08d6b8538ec44
|
data/ext/date/date_core.c
CHANGED
@@ -4328,40 +4328,12 @@ date_s_strptime(int argc, VALUE *argv, VALUE klass)
|
|
4328
4328
|
|
4329
4329
|
VALUE date__parse(VALUE str, VALUE comp);
|
4330
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
|
-
if (NIL_P(str)) return;
|
4346
|
-
if (SYMBOL_P(str)) str = rb_sym2str(str);
|
4347
|
-
|
4348
|
-
StringValue(str);
|
4349
|
-
size_t slen = RSTRING_LEN(str);
|
4350
|
-
size_t limit = get_limit(opt);
|
4351
|
-
if (slen > limit) {
|
4352
|
-
rb_raise(rb_eArgError,
|
4353
|
-
"string length (%"PRI_SIZE_PREFIX"u) exceeds the limit %"PRI_SIZE_PREFIX"u", slen, limit);
|
4354
|
-
}
|
4355
|
-
}
|
4356
|
-
|
4357
4331
|
static VALUE
|
4358
4332
|
date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
4359
4333
|
{
|
4360
|
-
VALUE vstr, vcomp, hash
|
4334
|
+
VALUE vstr, vcomp, hash;
|
4361
4335
|
|
4362
|
-
rb_scan_args(argc, argv, "11
|
4363
|
-
if (!NIL_P(opt)) argc--;
|
4364
|
-
check_limit(vstr, opt);
|
4336
|
+
rb_scan_args(argc, argv, "11", &vstr, &vcomp);
|
4365
4337
|
StringValue(vstr);
|
4366
4338
|
if (!rb_enc_str_asciicompat_p(vstr))
|
4367
4339
|
rb_raise(rb_eArgError,
|
@@ -4376,12 +4348,12 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
|
4376
4348
|
|
4377
4349
|
/*
|
4378
4350
|
* call-seq:
|
4379
|
-
* Date._parse(string[, comp=true]
|
4351
|
+
* Date._parse(string[, comp=true]) -> hash
|
4380
4352
|
*
|
4381
4353
|
* Parses the given representation of date and time, and returns a
|
4382
4354
|
* hash of parsed elements.
|
4383
4355
|
*
|
4384
|
-
* This method
|
4356
|
+
* This method *does not* function as a validator. If the input
|
4385
4357
|
* string does not match valid formats strictly, you may get a cryptic
|
4386
4358
|
* result. Should consider to use `Date._strptime` or
|
4387
4359
|
* `DateTime._strptime` instead of this method as possible.
|
@@ -4391,10 +4363,6 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
|
4391
4363
|
* it full.
|
4392
4364
|
*
|
4393
4365
|
* Date._parse('2001-02-03') #=> {:year=>2001, :mon=>2, :mday=>3}
|
4394
|
-
*
|
4395
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4396
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4397
|
-
* it may take a long time to parse.
|
4398
4366
|
*/
|
4399
4367
|
static VALUE
|
4400
4368
|
date_s__parse(int argc, VALUE *argv, VALUE klass)
|
@@ -4404,12 +4372,12 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
|
|
4404
4372
|
|
4405
4373
|
/*
|
4406
4374
|
* call-seq:
|
4407
|
-
* Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]]
|
4375
|
+
* Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]]) -> date
|
4408
4376
|
*
|
4409
4377
|
* Parses the given representation of date and time, and creates a
|
4410
4378
|
* date object.
|
4411
4379
|
*
|
4412
|
-
* This method
|
4380
|
+
* This method *does not* function as a validator. If the input
|
4413
4381
|
* string does not match valid formats strictly, you may get a cryptic
|
4414
4382
|
* result. Should consider to use `Date.strptime` instead of this
|
4415
4383
|
* method as possible.
|
@@ -4421,18 +4389,13 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
|
|
4421
4389
|
* Date.parse('2001-02-03') #=> #<Date: 2001-02-03 ...>
|
4422
4390
|
* Date.parse('20010203') #=> #<Date: 2001-02-03 ...>
|
4423
4391
|
* Date.parse('3rd Feb 2001') #=> #<Date: 2001-02-03 ...>
|
4424
|
-
*
|
4425
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4426
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4427
|
-
* it may take a long time to parse.
|
4428
4392
|
*/
|
4429
4393
|
static VALUE
|
4430
4394
|
date_s_parse(int argc, VALUE *argv, VALUE klass)
|
4431
4395
|
{
|
4432
|
-
VALUE str, comp, sg
|
4396
|
+
VALUE str, comp, sg;
|
4433
4397
|
|
4434
|
-
rb_scan_args(argc, argv, "03
|
4435
|
-
if (!NIL_P(opt)) argc--;
|
4398
|
+
rb_scan_args(argc, argv, "03", &str, &comp, &sg);
|
4436
4399
|
|
4437
4400
|
switch (argc) {
|
4438
4401
|
case 0:
|
@@ -4444,12 +4407,11 @@ date_s_parse(int argc, VALUE *argv, VALUE klass)
|
|
4444
4407
|
}
|
4445
4408
|
|
4446
4409
|
{
|
4447
|
-
|
4448
|
-
|
4449
|
-
|
4450
|
-
|
4451
|
-
|
4452
|
-
VALUE hash = date_s__parse(argc2, argv2, klass);
|
4410
|
+
VALUE argv2[2], hash;
|
4411
|
+
|
4412
|
+
argv2[0] = str;
|
4413
|
+
argv2[1] = comp;
|
4414
|
+
hash = date_s__parse(2, argv2, klass);
|
4453
4415
|
return d_new_by_frags(klass, hash, sg);
|
4454
4416
|
}
|
4455
4417
|
}
|
@@ -4463,28 +4425,19 @@ VALUE date__jisx0301(VALUE);
|
|
4463
4425
|
|
4464
4426
|
/*
|
4465
4427
|
* call-seq:
|
4466
|
-
* Date._iso8601(string
|
4428
|
+
* Date._iso8601(string) -> hash
|
4467
4429
|
*
|
4468
4430
|
* Returns a hash of parsed elements.
|
4469
|
-
*
|
4470
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4471
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4472
|
-
* it may take a long time to parse.
|
4473
4431
|
*/
|
4474
4432
|
static VALUE
|
4475
|
-
date_s__iso8601(
|
4433
|
+
date_s__iso8601(VALUE klass, VALUE str)
|
4476
4434
|
{
|
4477
|
-
VALUE str, opt;
|
4478
|
-
|
4479
|
-
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4480
|
-
check_limit(str, opt);
|
4481
|
-
|
4482
4435
|
return date__iso8601(str);
|
4483
4436
|
}
|
4484
4437
|
|
4485
4438
|
/*
|
4486
4439
|
* call-seq:
|
4487
|
-
* Date.iso8601(string='-4712-01-01'[, start=Date::ITALY]
|
4440
|
+
* Date.iso8601(string='-4712-01-01'[, start=Date::ITALY]) -> date
|
4488
4441
|
*
|
4489
4442
|
* Creates a new Date object by parsing from a string according to
|
4490
4443
|
* some typical ISO 8601 formats.
|
@@ -4492,18 +4445,13 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
|
|
4492
4445
|
* Date.iso8601('2001-02-03') #=> #<Date: 2001-02-03 ...>
|
4493
4446
|
* Date.iso8601('20010203') #=> #<Date: 2001-02-03 ...>
|
4494
4447
|
* Date.iso8601('2001-W05-6') #=> #<Date: 2001-02-03 ...>
|
4495
|
-
*
|
4496
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4497
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4498
|
-
* it may take a long time to parse.
|
4499
4448
|
*/
|
4500
4449
|
static VALUE
|
4501
4450
|
date_s_iso8601(int argc, VALUE *argv, VALUE klass)
|
4502
4451
|
{
|
4503
|
-
VALUE str, sg
|
4452
|
+
VALUE str, sg;
|
4504
4453
|
|
4505
|
-
rb_scan_args(argc, argv, "02
|
4506
|
-
if (!NIL_P(opt)) argc--;
|
4454
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
4507
4455
|
|
4508
4456
|
switch (argc) {
|
4509
4457
|
case 0:
|
@@ -4513,56 +4461,38 @@ date_s_iso8601(int argc, VALUE *argv, VALUE klass)
|
|
4513
4461
|
}
|
4514
4462
|
|
4515
4463
|
{
|
4516
|
-
|
4517
|
-
VALUE argv2[2];
|
4518
|
-
argv2[0] = str;
|
4519
|
-
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4520
|
-
VALUE hash = date_s__iso8601(argc2, argv2, klass);
|
4464
|
+
VALUE hash = date_s__iso8601(klass, str);
|
4521
4465
|
return d_new_by_frags(klass, hash, sg);
|
4522
4466
|
}
|
4523
4467
|
}
|
4524
4468
|
|
4525
4469
|
/*
|
4526
4470
|
* call-seq:
|
4527
|
-
* Date._rfc3339(string
|
4471
|
+
* Date._rfc3339(string) -> hash
|
4528
4472
|
*
|
4529
4473
|
* Returns a hash of parsed elements.
|
4530
|
-
*
|
4531
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4532
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4533
|
-
* it may take a long time to parse.
|
4534
4474
|
*/
|
4535
4475
|
static VALUE
|
4536
|
-
date_s__rfc3339(
|
4476
|
+
date_s__rfc3339(VALUE klass, VALUE str)
|
4537
4477
|
{
|
4538
|
-
VALUE str, opt;
|
4539
|
-
|
4540
|
-
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4541
|
-
check_limit(str, opt);
|
4542
|
-
|
4543
4478
|
return date__rfc3339(str);
|
4544
4479
|
}
|
4545
4480
|
|
4546
4481
|
/*
|
4547
4482
|
* call-seq:
|
4548
|
-
* Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]
|
4483
|
+
* Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> date
|
4549
4484
|
*
|
4550
4485
|
* Creates a new Date object by parsing from a string according to
|
4551
4486
|
* some typical RFC 3339 formats.
|
4552
4487
|
*
|
4553
4488
|
* Date.rfc3339('2001-02-03T04:05:06+07:00') #=> #<Date: 2001-02-03 ...>
|
4554
|
-
*
|
4555
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4556
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4557
|
-
* it may take a long time to parse.
|
4558
4489
|
*/
|
4559
4490
|
static VALUE
|
4560
4491
|
date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
|
4561
4492
|
{
|
4562
|
-
VALUE str, sg
|
4493
|
+
VALUE str, sg;
|
4563
4494
|
|
4564
|
-
rb_scan_args(argc, argv, "02
|
4565
|
-
if (!NIL_P(opt)) argc--;
|
4495
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
4566
4496
|
|
4567
4497
|
switch (argc) {
|
4568
4498
|
case 0:
|
@@ -4572,56 +4502,38 @@ date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
|
|
4572
4502
|
}
|
4573
4503
|
|
4574
4504
|
{
|
4575
|
-
|
4576
|
-
VALUE argv2[2];
|
4577
|
-
argv2[0] = str;
|
4578
|
-
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4579
|
-
VALUE hash = date_s__rfc3339(argc2, argv2, klass);
|
4505
|
+
VALUE hash = date_s__rfc3339(klass, str);
|
4580
4506
|
return d_new_by_frags(klass, hash, sg);
|
4581
4507
|
}
|
4582
4508
|
}
|
4583
4509
|
|
4584
4510
|
/*
|
4585
4511
|
* call-seq:
|
4586
|
-
* Date._xmlschema(string
|
4512
|
+
* Date._xmlschema(string) -> hash
|
4587
4513
|
*
|
4588
4514
|
* Returns a hash of parsed elements.
|
4589
|
-
*
|
4590
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4591
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4592
|
-
* it may take a long time to parse.
|
4593
4515
|
*/
|
4594
4516
|
static VALUE
|
4595
|
-
date_s__xmlschema(
|
4517
|
+
date_s__xmlschema(VALUE klass, VALUE str)
|
4596
4518
|
{
|
4597
|
-
VALUE str, opt;
|
4598
|
-
|
4599
|
-
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4600
|
-
check_limit(str, opt);
|
4601
|
-
|
4602
4519
|
return date__xmlschema(str);
|
4603
4520
|
}
|
4604
4521
|
|
4605
4522
|
/*
|
4606
4523
|
* call-seq:
|
4607
|
-
* Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY]
|
4524
|
+
* Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY]) -> date
|
4608
4525
|
*
|
4609
4526
|
* Creates a new Date object by parsing from a string according to
|
4610
4527
|
* some typical XML Schema formats.
|
4611
4528
|
*
|
4612
4529
|
* Date.xmlschema('2001-02-03') #=> #<Date: 2001-02-03 ...>
|
4613
|
-
*
|
4614
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4615
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4616
|
-
* it may take a long time to parse.
|
4617
4530
|
*/
|
4618
4531
|
static VALUE
|
4619
4532
|
date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
|
4620
4533
|
{
|
4621
|
-
VALUE str, sg
|
4534
|
+
VALUE str, sg;
|
4622
4535
|
|
4623
|
-
rb_scan_args(argc, argv, "02
|
4624
|
-
if (!NIL_P(opt)) argc--;
|
4536
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
4625
4537
|
|
4626
4538
|
switch (argc) {
|
4627
4539
|
case 0:
|
@@ -4631,58 +4543,41 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
|
|
4631
4543
|
}
|
4632
4544
|
|
4633
4545
|
{
|
4634
|
-
|
4635
|
-
VALUE argv2[2];
|
4636
|
-
argv2[0] = str;
|
4637
|
-
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4638
|
-
VALUE hash = date_s__xmlschema(argc2, argv2, klass);
|
4546
|
+
VALUE hash = date_s__xmlschema(klass, str);
|
4639
4547
|
return d_new_by_frags(klass, hash, sg);
|
4640
4548
|
}
|
4641
4549
|
}
|
4642
4550
|
|
4643
4551
|
/*
|
4644
4552
|
* call-seq:
|
4645
|
-
* Date._rfc2822(string
|
4646
|
-
* Date._rfc822(string
|
4553
|
+
* Date._rfc2822(string) -> hash
|
4554
|
+
* Date._rfc822(string) -> hash
|
4647
4555
|
*
|
4648
4556
|
* Returns a hash of parsed elements.
|
4649
|
-
*
|
4650
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4651
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4652
|
-
* it may take a long time to parse.
|
4653
4557
|
*/
|
4654
4558
|
static VALUE
|
4655
|
-
date_s__rfc2822(
|
4559
|
+
date_s__rfc2822(VALUE klass, VALUE str)
|
4656
4560
|
{
|
4657
|
-
VALUE str, opt;
|
4658
|
-
|
4659
|
-
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4660
|
-
check_limit(str, opt);
|
4661
|
-
|
4662
4561
|
return date__rfc2822(str);
|
4663
4562
|
}
|
4664
4563
|
|
4665
4564
|
/*
|
4666
4565
|
* call-seq:
|
4667
|
-
* Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]
|
4668
|
-
* Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]
|
4566
|
+
* Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date
|
4567
|
+
* Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date
|
4669
4568
|
*
|
4670
4569
|
* Creates a new Date object by parsing from a string according to
|
4671
4570
|
* some typical RFC 2822 formats.
|
4672
4571
|
*
|
4673
4572
|
* Date.rfc2822('Sat, 3 Feb 2001 00:00:00 +0000')
|
4674
4573
|
* #=> #<Date: 2001-02-03 ...>
|
4675
|
-
*
|
4676
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4677
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4678
|
-
* it may take a long time to parse.
|
4679
4574
|
*/
|
4680
4575
|
static VALUE
|
4681
4576
|
date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
4682
4577
|
{
|
4683
|
-
VALUE str, sg
|
4578
|
+
VALUE str, sg;
|
4684
4579
|
|
4685
|
-
rb_scan_args(argc, argv, "02
|
4580
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
4686
4581
|
|
4687
4582
|
switch (argc) {
|
4688
4583
|
case 0:
|
@@ -4692,56 +4587,39 @@ date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
|
4692
4587
|
}
|
4693
4588
|
|
4694
4589
|
{
|
4695
|
-
|
4696
|
-
VALUE argv2[2];
|
4697
|
-
argv2[0] = str;
|
4698
|
-
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4699
|
-
VALUE hash = date_s__rfc2822(argc2, argv2, klass);
|
4590
|
+
VALUE hash = date_s__rfc2822(klass, str);
|
4700
4591
|
return d_new_by_frags(klass, hash, sg);
|
4701
4592
|
}
|
4702
4593
|
}
|
4703
4594
|
|
4704
4595
|
/*
|
4705
4596
|
* call-seq:
|
4706
|
-
* Date._httpdate(string
|
4597
|
+
* Date._httpdate(string) -> hash
|
4707
4598
|
*
|
4708
4599
|
* Returns a hash of parsed elements.
|
4709
|
-
*
|
4710
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4711
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4712
|
-
* it may take a long time to parse.
|
4713
4600
|
*/
|
4714
4601
|
static VALUE
|
4715
|
-
date_s__httpdate(
|
4602
|
+
date_s__httpdate(VALUE klass, VALUE str)
|
4716
4603
|
{
|
4717
|
-
VALUE str, opt;
|
4718
|
-
|
4719
|
-
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4720
|
-
check_limit(str, opt);
|
4721
|
-
|
4722
4604
|
return date__httpdate(str);
|
4723
4605
|
}
|
4724
4606
|
|
4725
4607
|
/*
|
4726
4608
|
* call-seq:
|
4727
|
-
* Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY]
|
4609
|
+
* Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY]) -> date
|
4728
4610
|
*
|
4729
4611
|
* Creates a new Date object by parsing from a string according to
|
4730
4612
|
* some RFC 2616 format.
|
4731
4613
|
*
|
4732
4614
|
* Date.httpdate('Sat, 03 Feb 2001 00:00:00 GMT')
|
4733
4615
|
* #=> #<Date: 2001-02-03 ...>
|
4734
|
-
*
|
4735
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4736
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4737
|
-
* it may take a long time to parse.
|
4738
4616
|
*/
|
4739
4617
|
static VALUE
|
4740
4618
|
date_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
4741
4619
|
{
|
4742
|
-
VALUE str, sg
|
4620
|
+
VALUE str, sg;
|
4743
4621
|
|
4744
|
-
rb_scan_args(argc, argv, "02
|
4622
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
4745
4623
|
|
4746
4624
|
switch (argc) {
|
4747
4625
|
case 0:
|
@@ -4751,39 +4629,26 @@ date_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
|
4751
4629
|
}
|
4752
4630
|
|
4753
4631
|
{
|
4754
|
-
|
4755
|
-
VALUE argv2[2];
|
4756
|
-
argv2[0] = str;
|
4757
|
-
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4758
|
-
VALUE hash = date_s__httpdate(argc2, argv2, klass);
|
4632
|
+
VALUE hash = date_s__httpdate(klass, str);
|
4759
4633
|
return d_new_by_frags(klass, hash, sg);
|
4760
4634
|
}
|
4761
4635
|
}
|
4762
4636
|
|
4763
4637
|
/*
|
4764
4638
|
* call-seq:
|
4765
|
-
* Date._jisx0301(string
|
4639
|
+
* Date._jisx0301(string) -> hash
|
4766
4640
|
*
|
4767
4641
|
* Returns a hash of parsed elements.
|
4768
|
-
*
|
4769
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4770
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4771
|
-
* it may take a long time to parse.
|
4772
4642
|
*/
|
4773
4643
|
static VALUE
|
4774
|
-
date_s__jisx0301(
|
4644
|
+
date_s__jisx0301(VALUE klass, VALUE str)
|
4775
4645
|
{
|
4776
|
-
VALUE str, opt;
|
4777
|
-
|
4778
|
-
rb_scan_args(argc, argv, "1:", &str, &opt);
|
4779
|
-
check_limit(str, opt);
|
4780
|
-
|
4781
4646
|
return date__jisx0301(str);
|
4782
4647
|
}
|
4783
4648
|
|
4784
4649
|
/*
|
4785
4650
|
* call-seq:
|
4786
|
-
* Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY]
|
4651
|
+
* Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY]) -> date
|
4787
4652
|
*
|
4788
4653
|
* Creates a new Date object by parsing from a string according to
|
4789
4654
|
* some typical JIS X 0301 formats.
|
@@ -4793,18 +4658,13 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
|
|
4793
4658
|
* For no-era year, legacy format, Heisei is assumed.
|
4794
4659
|
*
|
4795
4660
|
* Date.jisx0301('13.02.03') #=> #<Date: 2001-02-03 ...>
|
4796
|
-
*
|
4797
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
4798
|
-
* You can stop this check by passing `limit: nil`, but note that
|
4799
|
-
* it may take a long time to parse.
|
4800
4661
|
*/
|
4801
4662
|
static VALUE
|
4802
4663
|
date_s_jisx0301(int argc, VALUE *argv, VALUE klass)
|
4803
4664
|
{
|
4804
|
-
VALUE str, sg
|
4665
|
+
VALUE str, sg;
|
4805
4666
|
|
4806
|
-
rb_scan_args(argc, argv, "02
|
4807
|
-
if (!NIL_P(opt)) argc--;
|
4667
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
4808
4668
|
|
4809
4669
|
switch (argc) {
|
4810
4670
|
case 0:
|
@@ -4814,11 +4674,7 @@ date_s_jisx0301(int argc, VALUE *argv, VALUE klass)
|
|
4814
4674
|
}
|
4815
4675
|
|
4816
4676
|
{
|
4817
|
-
|
4818
|
-
VALUE argv2[2];
|
4819
|
-
argv2[0] = str;
|
4820
|
-
if (!NIL_P(opt)) argv2[argc2++] = opt;
|
4821
|
-
VALUE hash = date_s__jisx0301(argc2, argv2, klass);
|
4677
|
+
VALUE hash = date_s__jisx0301(klass, str);
|
4822
4678
|
return d_new_by_frags(klass, hash, sg);
|
4823
4679
|
}
|
4824
4680
|
}
|
@@ -7044,7 +6900,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
|
|
7044
6900
|
* %c - date and time (%a %b %e %T %Y)
|
7045
6901
|
* %D - Date (%m/%d/%y)
|
7046
6902
|
* %F - The ISO 8601 date format (%Y-%m-%d)
|
7047
|
-
* %v - VMS date (%e
|
6903
|
+
* %v - VMS date (%e-%^b-%Y)
|
7048
6904
|
* %x - Same as %D
|
7049
6905
|
* %X - Same as %T
|
7050
6906
|
* %r - 12-hour time (%I:%M:%S %p)
|
@@ -7941,7 +7797,7 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass)
|
|
7941
7797
|
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
|
7942
7798
|
of = tm.tm_gmtoff;
|
7943
7799
|
#elif defined(HAVE_TIMEZONE)
|
7944
|
-
#
|
7800
|
+
#if defined(HAVE_ALTZONE) && !defined(_AIX)
|
7945
7801
|
of = (long)-((tm.tm_isdst > 0) ? altzone : timezone);
|
7946
7802
|
#else
|
7947
7803
|
of = (long)-timezone;
|
@@ -8157,12 +8013,12 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
|
|
8157
8013
|
|
8158
8014
|
/*
|
8159
8015
|
* call-seq:
|
8160
|
-
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]]
|
8016
|
+
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]]) -> datetime
|
8161
8017
|
*
|
8162
8018
|
* Parses the given representation of date and time, and creates a
|
8163
8019
|
* DateTime object.
|
8164
8020
|
*
|
8165
|
-
* This method
|
8021
|
+
* This method *does not* function as a validator. If the input
|
8166
8022
|
* string does not match valid formats strictly, you may get a cryptic
|
8167
8023
|
* result. Should consider to use `DateTime.strptime` instead of this
|
8168
8024
|
* method as possible.
|
@@ -8176,18 +8032,13 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
|
|
8176
8032
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8177
8033
|
* DateTime.parse('3rd Feb 2001 04:05:06 PM')
|
8178
8034
|
* #=> #<DateTime: 2001-02-03T16:05:06+00:00 ...>
|
8179
|
-
*
|
8180
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
8181
|
-
* You can stop this check by passing `limit: nil`, but note that
|
8182
|
-
* it may take a long time to parse.
|
8183
8035
|
*/
|
8184
8036
|
static VALUE
|
8185
8037
|
datetime_s_parse(int argc, VALUE *argv, VALUE klass)
|
8186
8038
|
{
|
8187
|
-
VALUE str, comp, sg
|
8039
|
+
VALUE str, comp, sg;
|
8188
8040
|
|
8189
|
-
rb_scan_args(argc, argv, "03
|
8190
|
-
if (!NIL_P(opt)) argc--;
|
8041
|
+
rb_scan_args(argc, argv, "03", &str, &comp, &sg);
|
8191
8042
|
|
8192
8043
|
switch (argc) {
|
8193
8044
|
case 0:
|
@@ -8199,20 +8050,18 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass)
|
|
8199
8050
|
}
|
8200
8051
|
|
8201
8052
|
{
|
8202
|
-
|
8203
|
-
|
8204
|
-
|
8205
|
-
|
8206
|
-
|
8207
|
-
if (!NIL_P(opt)) argc2++;
|
8208
|
-
VALUE hash = date_s__parse(argc2, argv2, klass);
|
8053
|
+
VALUE argv2[2], hash;
|
8054
|
+
|
8055
|
+
argv2[0] = str;
|
8056
|
+
argv2[1] = comp;
|
8057
|
+
hash = date_s__parse(2, argv2, klass);
|
8209
8058
|
return dt_new_by_frags(klass, hash, sg);
|
8210
8059
|
}
|
8211
8060
|
}
|
8212
8061
|
|
8213
8062
|
/*
|
8214
8063
|
* call-seq:
|
8215
|
-
* DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]
|
8064
|
+
* DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
8216
8065
|
*
|
8217
8066
|
* Creates a new DateTime object by parsing from a string according to
|
8218
8067
|
* some typical ISO 8601 formats.
|
@@ -8223,18 +8072,13 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass)
|
|
8223
8072
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8224
8073
|
* DateTime.iso8601('2001-W05-6T04:05:06+07:00')
|
8225
8074
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8226
|
-
*
|
8227
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
8228
|
-
* You can stop this check by passing `limit: nil`, but note that
|
8229
|
-
* it may take a long time to parse.
|
8230
8075
|
*/
|
8231
8076
|
static VALUE
|
8232
8077
|
datetime_s_iso8601(int argc, VALUE *argv, VALUE klass)
|
8233
8078
|
{
|
8234
|
-
VALUE str, sg
|
8079
|
+
VALUE str, sg;
|
8235
8080
|
|
8236
|
-
rb_scan_args(argc, argv, "02
|
8237
|
-
if (!NIL_P(opt)) argc--;
|
8081
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
8238
8082
|
|
8239
8083
|
switch (argc) {
|
8240
8084
|
case 0:
|
@@ -8244,37 +8088,27 @@ datetime_s_iso8601(int argc, VALUE *argv, VALUE klass)
|
|
8244
8088
|
}
|
8245
8089
|
|
8246
8090
|
{
|
8247
|
-
|
8248
|
-
VALUE argv2[2];
|
8249
|
-
argv2[0] = str;
|
8250
|
-
argv2[1] = opt;
|
8251
|
-
if (!NIL_P(opt)) argc2--;
|
8252
|
-
VALUE hash = date_s__iso8601(argc2, argv2, klass);
|
8091
|
+
VALUE hash = date_s__iso8601(klass, str);
|
8253
8092
|
return dt_new_by_frags(klass, hash, sg);
|
8254
8093
|
}
|
8255
8094
|
}
|
8256
8095
|
|
8257
8096
|
/*
|
8258
8097
|
* call-seq:
|
8259
|
-
* DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]
|
8098
|
+
* DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
8260
8099
|
*
|
8261
8100
|
* Creates a new DateTime object by parsing from a string according to
|
8262
8101
|
* some typical RFC 3339 formats.
|
8263
8102
|
*
|
8264
8103
|
* DateTime.rfc3339('2001-02-03T04:05:06+07:00')
|
8265
8104
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8266
|
-
*
|
8267
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
8268
|
-
* You can stop this check by passing `limit: nil`, but note that
|
8269
|
-
* it may take a long time to parse.
|
8270
8105
|
*/
|
8271
8106
|
static VALUE
|
8272
8107
|
datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass)
|
8273
8108
|
{
|
8274
|
-
VALUE str, sg
|
8109
|
+
VALUE str, sg;
|
8275
8110
|
|
8276
|
-
rb_scan_args(argc, argv, "02
|
8277
|
-
if (!NIL_P(opt)) argc--;
|
8111
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
8278
8112
|
|
8279
8113
|
switch (argc) {
|
8280
8114
|
case 0:
|
@@ -8284,37 +8118,27 @@ datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass)
|
|
8284
8118
|
}
|
8285
8119
|
|
8286
8120
|
{
|
8287
|
-
|
8288
|
-
VALUE argv2[2];
|
8289
|
-
argv2[0] = str;
|
8290
|
-
argv2[1] = opt;
|
8291
|
-
if (!NIL_P(opt)) argc2++;
|
8292
|
-
VALUE hash = date_s__rfc3339(argc2, argv2, klass);
|
8121
|
+
VALUE hash = date_s__rfc3339(klass, str);
|
8293
8122
|
return dt_new_by_frags(klass, hash, sg);
|
8294
8123
|
}
|
8295
8124
|
}
|
8296
8125
|
|
8297
8126
|
/*
|
8298
8127
|
* call-seq:
|
8299
|
-
* DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]
|
8128
|
+
* DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
8300
8129
|
*
|
8301
8130
|
* Creates a new DateTime object by parsing from a string according to
|
8302
8131
|
* some typical XML Schema formats.
|
8303
8132
|
*
|
8304
8133
|
* DateTime.xmlschema('2001-02-03T04:05:06+07:00')
|
8305
8134
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8306
|
-
*
|
8307
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
8308
|
-
* You can stop this check by passing `limit: nil`, but note that
|
8309
|
-
* it may take a long time to parse.
|
8310
8135
|
*/
|
8311
8136
|
static VALUE
|
8312
8137
|
datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass)
|
8313
8138
|
{
|
8314
|
-
VALUE str, sg
|
8139
|
+
VALUE str, sg;
|
8315
8140
|
|
8316
|
-
rb_scan_args(argc, argv, "02
|
8317
|
-
if (!NIL_P(opt)) argc--;
|
8141
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
8318
8142
|
|
8319
8143
|
switch (argc) {
|
8320
8144
|
case 0:
|
@@ -8324,38 +8148,28 @@ datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass)
|
|
8324
8148
|
}
|
8325
8149
|
|
8326
8150
|
{
|
8327
|
-
|
8328
|
-
VALUE argv2[2];
|
8329
|
-
argv2[0] = str;
|
8330
|
-
argv2[1] = opt;
|
8331
|
-
if (!NIL_P(opt)) argc2++;
|
8332
|
-
VALUE hash = date_s__xmlschema(argc2, argv2, klass);
|
8151
|
+
VALUE hash = date_s__xmlschema(klass, str);
|
8333
8152
|
return dt_new_by_frags(klass, hash, sg);
|
8334
8153
|
}
|
8335
8154
|
}
|
8336
8155
|
|
8337
8156
|
/*
|
8338
8157
|
* call-seq:
|
8339
|
-
* DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]
|
8340
|
-
* DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]
|
8158
|
+
* DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> datetime
|
8159
|
+
* DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> datetime
|
8341
8160
|
*
|
8342
8161
|
* Creates a new DateTime object by parsing from a string according to
|
8343
8162
|
* some typical RFC 2822 formats.
|
8344
8163
|
*
|
8345
8164
|
* DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700')
|
8346
8165
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8347
|
-
*
|
8348
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
8349
|
-
* You can stop this check by passing `limit: nil`, but note that
|
8350
|
-
* it may take a long time to parse.
|
8351
8166
|
*/
|
8352
8167
|
static VALUE
|
8353
8168
|
datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
8354
8169
|
{
|
8355
|
-
VALUE str, sg
|
8170
|
+
VALUE str, sg;
|
8356
8171
|
|
8357
|
-
rb_scan_args(argc, argv, "02
|
8358
|
-
if (!NIL_P(opt)) argc--;
|
8172
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
8359
8173
|
|
8360
8174
|
switch (argc) {
|
8361
8175
|
case 0:
|
@@ -8365,12 +8179,7 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
|
8365
8179
|
}
|
8366
8180
|
|
8367
8181
|
{
|
8368
|
-
|
8369
|
-
VALUE argv2[2];
|
8370
|
-
argv2[0] = str;
|
8371
|
-
argv2[1] = opt;
|
8372
|
-
if (!NIL_P(opt)) argc2++;
|
8373
|
-
VALUE hash = date_s__rfc2822(argc2, argv2, klass);
|
8182
|
+
VALUE hash = date_s__rfc2822(klass, str);
|
8374
8183
|
return dt_new_by_frags(klass, hash, sg);
|
8375
8184
|
}
|
8376
8185
|
}
|
@@ -8384,18 +8193,13 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass)
|
|
8384
8193
|
*
|
8385
8194
|
* DateTime.httpdate('Sat, 03 Feb 2001 04:05:06 GMT')
|
8386
8195
|
* #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...>
|
8387
|
-
*
|
8388
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
8389
|
-
* You can stop this check by passing `limit: nil`, but note that
|
8390
|
-
* it may take a long time to parse.
|
8391
8196
|
*/
|
8392
8197
|
static VALUE
|
8393
8198
|
datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
8394
8199
|
{
|
8395
|
-
VALUE str, sg
|
8200
|
+
VALUE str, sg;
|
8396
8201
|
|
8397
|
-
rb_scan_args(argc, argv, "02
|
8398
|
-
if (!NIL_P(opt)) argc--;
|
8202
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
8399
8203
|
|
8400
8204
|
switch (argc) {
|
8401
8205
|
case 0:
|
@@ -8405,19 +8209,14 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
|
8405
8209
|
}
|
8406
8210
|
|
8407
8211
|
{
|
8408
|
-
|
8409
|
-
VALUE argv2[2];
|
8410
|
-
argv2[0] = str;
|
8411
|
-
argv2[1] = opt;
|
8412
|
-
if (!NIL_P(opt)) argc2++;
|
8413
|
-
VALUE hash = date_s__httpdate(argc2, argv2, klass);
|
8212
|
+
VALUE hash = date_s__httpdate(klass, str);
|
8414
8213
|
return dt_new_by_frags(klass, hash, sg);
|
8415
8214
|
}
|
8416
8215
|
}
|
8417
8216
|
|
8418
8217
|
/*
|
8419
8218
|
* call-seq:
|
8420
|
-
* DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]
|
8219
|
+
* DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
8421
8220
|
*
|
8422
8221
|
* Creates a new DateTime object by parsing from a string according to
|
8423
8222
|
* some typical JIS X 0301 formats.
|
@@ -8429,18 +8228,13 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
|
8429
8228
|
*
|
8430
8229
|
* DateTime.jisx0301('13.02.03T04:05:06+07:00')
|
8431
8230
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8432
|
-
*
|
8433
|
-
* Raise an ArgumentError when the string length is longer than _limit_.
|
8434
|
-
* You can stop this check by passing `limit: nil`, but note that
|
8435
|
-
* it may take a long time to parse.
|
8436
8231
|
*/
|
8437
8232
|
static VALUE
|
8438
8233
|
datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass)
|
8439
8234
|
{
|
8440
|
-
VALUE str, sg
|
8235
|
+
VALUE str, sg;
|
8441
8236
|
|
8442
|
-
rb_scan_args(argc, argv, "02
|
8443
|
-
if (!NIL_P(opt)) argc--;
|
8237
|
+
rb_scan_args(argc, argv, "02", &str, &sg);
|
8444
8238
|
|
8445
8239
|
switch (argc) {
|
8446
8240
|
case 0:
|
@@ -8450,12 +8244,7 @@ datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass)
|
|
8450
8244
|
}
|
8451
8245
|
|
8452
8246
|
{
|
8453
|
-
|
8454
|
-
VALUE argv2[2];
|
8455
|
-
argv2[0] = str;
|
8456
|
-
argv2[1] = opt;
|
8457
|
-
if (!NIL_P(opt)) argc2++;
|
8458
|
-
VALUE hash = date_s__jisx0301(argc2, argv2, klass);
|
8247
|
+
VALUE hash = date_s__jisx0301(klass, str);
|
8459
8248
|
return dt_new_by_frags(klass, hash, sg);
|
8460
8249
|
}
|
8461
8250
|
}
|
@@ -8591,7 +8380,7 @@ dt_lite_to_s(VALUE self)
|
|
8591
8380
|
* %c - date and time (%a %b %e %T %Y)
|
8592
8381
|
* %D - Date (%m/%d/%y)
|
8593
8382
|
* %F - The ISO 8601 date format (%Y-%m-%d)
|
8594
|
-
* %v - VMS date (%e
|
8383
|
+
* %v - VMS date (%e-%^b-%Y)
|
8595
8384
|
* %x - Same as %D
|
8596
8385
|
* %X - Same as %T
|
8597
8386
|
* %r - 12-hour time (%I:%M:%S %p)
|
@@ -9614,19 +9403,19 @@ Init_date_core(void)
|
|
9614
9403
|
rb_define_singleton_method(cDate, "strptime", date_s_strptime, -1);
|
9615
9404
|
rb_define_singleton_method(cDate, "_parse", date_s__parse, -1);
|
9616
9405
|
rb_define_singleton_method(cDate, "parse", date_s_parse, -1);
|
9617
|
-
rb_define_singleton_method(cDate, "_iso8601", date_s__iso8601,
|
9406
|
+
rb_define_singleton_method(cDate, "_iso8601", date_s__iso8601, 1);
|
9618
9407
|
rb_define_singleton_method(cDate, "iso8601", date_s_iso8601, -1);
|
9619
|
-
rb_define_singleton_method(cDate, "_rfc3339", date_s__rfc3339,
|
9408
|
+
rb_define_singleton_method(cDate, "_rfc3339", date_s__rfc3339, 1);
|
9620
9409
|
rb_define_singleton_method(cDate, "rfc3339", date_s_rfc3339, -1);
|
9621
|
-
rb_define_singleton_method(cDate, "_xmlschema", date_s__xmlschema,
|
9410
|
+
rb_define_singleton_method(cDate, "_xmlschema", date_s__xmlschema, 1);
|
9622
9411
|
rb_define_singleton_method(cDate, "xmlschema", date_s_xmlschema, -1);
|
9623
|
-
rb_define_singleton_method(cDate, "_rfc2822", date_s__rfc2822,
|
9624
|
-
rb_define_singleton_method(cDate, "_rfc822", date_s__rfc2822,
|
9412
|
+
rb_define_singleton_method(cDate, "_rfc2822", date_s__rfc2822, 1);
|
9413
|
+
rb_define_singleton_method(cDate, "_rfc822", date_s__rfc2822, 1);
|
9625
9414
|
rb_define_singleton_method(cDate, "rfc2822", date_s_rfc2822, -1);
|
9626
9415
|
rb_define_singleton_method(cDate, "rfc822", date_s_rfc2822, -1);
|
9627
|
-
rb_define_singleton_method(cDate, "_httpdate", date_s__httpdate,
|
9416
|
+
rb_define_singleton_method(cDate, "_httpdate", date_s__httpdate, 1);
|
9628
9417
|
rb_define_singleton_method(cDate, "httpdate", date_s_httpdate, -1);
|
9629
|
-
rb_define_singleton_method(cDate, "_jisx0301", date_s__jisx0301,
|
9418
|
+
rb_define_singleton_method(cDate, "_jisx0301", date_s__jisx0301, 1);
|
9630
9419
|
rb_define_singleton_method(cDate, "jisx0301", date_s_jisx0301, -1);
|
9631
9420
|
|
9632
9421
|
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
@@ -4,7 +4,6 @@
|
|
4
4
|
require 'date_core'
|
5
5
|
|
6
6
|
class Date
|
7
|
-
VERSION = '3.1.3' # :nodoc:
|
8
7
|
|
9
8
|
def infinite?
|
10
9
|
false
|
@@ -31,6 +30,8 @@ class Date
|
|
31
30
|
def <=>(other)
|
32
31
|
case other
|
33
32
|
when Infinity; return d <=> other.d
|
33
|
+
when Float::INFINITY; return d <=> 1
|
34
|
+
when -Float::INFINITY; return d <=> -1
|
34
35
|
when Numeric; return d
|
35
36
|
else
|
36
37
|
begin
|
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.
|
4
|
+
version: 3.2.0
|
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: 2021-
|
11
|
+
date: 2021-10-14 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.2.22
|
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: []
|