Sha256: faf2a5a7d883a4c1653f26750f46758c0f8c80700b3dda40cd6d659db4f6e7dd

Contents?: true

Size: 880 Bytes

Versions: 74

Compression:

Stored size: 880 Bytes

Contents

#include "rr.h"
#include "v8_date.h"
#include "v8_value.h"
#include "v8_handle.h"
#include "v8_object.h"

using namespace v8;

namespace {

  VALUE DateClass;

  VALUE New(VALUE self, VALUE time) {
    HandleScope scope;
    return rr_v8_handle_new(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) {
    Persistent<Date> date = rr_v8_handle<Date>(self);
    return rr_v82rb(date->NumberValue());
  }
}

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

VALUE rr_reflect_v8_date(Handle<Value> value) {
  return rr_reflect_v8_object_as(Handle<Object>::Cast(value), DateClass);
}

Version data entries

74 entries across 74 versions & 4 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.7.4 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.7.3 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.7.2 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.7.1 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.7.0 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.9 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.8 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.7 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.6 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.5 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.4 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.3 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.2 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.1 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.6.0 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.5.17 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.5.16 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.5.15 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp
classiccms-0.5.14 vendor/bundle/gems/therubyracer-0.10.1/ext/v8/v8_date.cpp