Method: Strptime#initialize

Defined in:
ext/strptime/strptime.c

#new(format) ⇒ Object

returns parser object

Parameters:

  • format (String)

    strptime(3) style format string.



632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'ext/strptime/strptime.c', line 632

static VALUE
strptime_init(VALUE self, VALUE fmt)
{
    struct strptime_object *tobj;
    void **isns;
    StringValueCStr(fmt);
    TypedData_Get_Struct(self, struct strptime_object, &strptime_data_type,
       tobj);
    isns = strptime_compile(RSTRING_PTR(fmt), RSTRING_LEN(fmt));
    tobj->isns = isns;
    tobj->fmt = rb_str_new_frozen(fmt);
    return self;
}