Method: Mysql::Time#initialize

Defined in:
ext/mysql_api/mysql.c

#initialize(*args) ⇒ Object


Mysql::Time object method


1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
# File 'ext/mysql_api/mysql.c', line 1772

static VALUE time_initialize(int argc, VALUE* argv, VALUE obj)
{
    VALUE year, month, day, hour, minute, second, neg, second_part;
    rb_scan_args(argc, argv, "08", &year, &month, &day, &hour, &minute, &second, &neg, &second_part);
#define NILorFIXvalue(o)  (NIL_P(o) ? INT2FIX(0) : (Check_Type(o, T_FIXNUM), o))
    rb_iv_set(obj, "year", NILorFIXvalue(year));
    rb_iv_set(obj, "month", NILorFIXvalue(month));
    rb_iv_set(obj, "day", NILorFIXvalue(day));
    rb_iv_set(obj, "hour", NILorFIXvalue(hour));
    rb_iv_set(obj, "minute", NILorFIXvalue(minute));
    rb_iv_set(obj, "second", NILorFIXvalue(second));
    rb_iv_set(obj, "neg", (neg == Qnil || neg == Qfalse) ? Qfalse : Qtrue);
    rb_iv_set(obj, "second_part", NILorFIXvalue(second_part));
    return obj;
}