Class: V8::Date

Inherits:
V8Value show all
Includes:
Comparable, Delegated
Defined in:
lib/v8/date.rb,
ext/v8/v8_date.cpp

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Delegated

#method_missing, #old_method_missing, #old_respond_to?, #respond_to?, #to_s

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Delegated

Class Method Details

.V8::Date.new(time) ⇒ Object

Returns new V8 date reflected from given ruby time value.



28
29
30
31
32
# File 'ext/v8/v8_date.cpp', line 28

static VALUE rb_v8_date_new(VALUE klass, VALUE time)
{
  HandleScope scope;
  return v8_ref_new(klass, to_v8_date(time));
}

Instance Method Details

#<=>(other) ⇒ Object



12
13
14
# File 'lib/v8/date.rb', line 12

def <=>(other)
  to_time <=> other
end

#delegateObject



16
17
18
# File 'lib/v8/date.rb', line 16

def delegate
  to_time
end

#to_iObject

Returns integer value representation of referenced v8 date.



41
42
43
44
45
# File 'ext/v8/v8_date.cpp', line 41

static VALUE rb_v8_date_to_i(VALUE self)
{
  HandleScope scope;
  return rb_int_new(unwrap(self)->NumberValue());
}

#to_timeObject



8
9
10
# File 'lib/v8/date.rb', line 8

def to_time
  Time.at(to_i);
end