Sha256: dd5a10fbf0f827c904eb3af21fe2d64f6c9ab56b216ca5f23c97d4d97b36a665

Contents?: true

Size: 875 Bytes

Versions: 11

Compression:

Stored size: 875 Bytes

Contents

#include "rr.h"
#include "v8_date.h"
#include "v8_value.h"
#include "v8_ref.h"

using namespace v8;

namespace {

  VALUE DateClass;

  VALUE New(VALUE self, VALUE time) {
    HandleScope scope;
    return rr_v8_ref_create(self, Date::New(NUM2DBL(time)));
  }

  // Override Value::NumberValue in order to ensure that we call the more specific and optimized
  // Number Value in v8::Date
  VALUE NumberValue(VALUE self) {
    HandleScope scope;
    Local<Date> date = V8_Ref_Get<Date>(self);
    return rr_v82rb(date->NumberValue());
  }
}

void rr_init_v8_date() {
  DateClass = rr_define_class("Date", rr_cV8_C_Value);
  rr_define_singleton_method(DateClass, "New", New, 1);
  rr_define_method(DateClass, "NumberValue", NumberValue, 0);
}

VALUE rr_reflect_v8_date(Handle<Value> value) {
  Local<Date> date(Date::Cast(*value));
  return rr_v8_ref_create(DateClass, date);
}

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
therubyracer-0.8.2 ext/v8/v8_date.cpp
therubyracer-0.8.2.pre2 ext/v8/v8_date.cpp
therubyracer-0.8.2.pre ext/v8/v8_date.cpp
therubyracer-0.8.1 ext/v8/v8_date.cpp
therubyracer-0.8.1.pre2 ext/v8/v8_date.cpp
therubyracer-heroku-0.8.1.pre3 ext/v8/v8_date.cpp
therubyracer-heroku-0.8.1.pre2 ext/v8/v8_date.cpp
therubyracer-0.8.1.pre1 ext/v8/v8_date.cpp
therubyracer-0.8.0 ext/v8/v8_date.cpp
therubyracer-0.8.0.pre3 ext/v8/v8_date.cpp
therubyracer-0.8.0.pre2 ext/v8/v8_date.cpp