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
2012-06-07 10:02:10 -05:00

18 lines
No EOL
405 B
C++

#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());
}
}