Method: Date.xmlschema

Defined in:
date_core.c

.xmlschema(string = '-4712-01-01'[, start=Date::ITALY]) ⇒ Object

Creates a new Date object by parsing from a string according to some typical XML Schema formats.

Date.xmlschema('2001-02-03')  #=> #<Date: 2001-02-03 ...>


4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
# File 'date_core.c', line 4531

static VALUE
date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
{
    VALUE str, sg;

    rb_scan_args(argc, argv, "02", &str, &sg);

    switch (argc) {
      case 0:
  str = rb_str_new2("-4712-01-01");
      case 1:
  sg = INT2FIX(DEFAULT_SG);
    }

    {
  VALUE hash = date_s__xmlschema(klass, str);
  return d_new_by_frags(klass, hash, sg);
    }
}