1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/ext/v8/date.cc

18 lines
405 B
C++
Raw Normal View History

2012-06-07 11:02:10 -04:00
#include "rr.h"
namespace rr {
void Date::Init() {
ClassBuilder("Date", Value::Class).
defineSingletonMethod("New", &New).
defineMethod("NumberValue", &NumberValue).
store(&Class);
}
VALUE Date::New(VALUE self, VALUE time) {
return Value(v8::Date::New(NUM2DBL(time)));
}
VALUE Date::NumberValue(VALUE self) {
return rb_float_new(Date(self)->NumberValue());
}
}