Class: Mustang::V8::Date
- Includes:
- Comparable, Delegated
- Defined in:
- lib/mustang/v8/date.rb,
ext/v8/v8_date.cpp
Class Method Summary collapse
-
.V8::Date.new(time) ⇒ Object
Returns new V8 date reflected from given ruby time value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #delegate ⇒ Object
- #kind_of?(klass) ⇒ Boolean
-
#to_i ⇒ Object
Returns integer value representation of referenced v8 date.
- #to_time ⇒ Object
Methods included from Delegated
#method_missing, #old_method_missing, #old_respond_to?, #respond_to?, #to_s
Methods inherited from Value
#==, #===, #array?, #ary?, #bool?, #boolean?, #date?, #empty?, #external?, #false?, #func?, #function?, #int?, #integer?, #null?, #num?, #number?, #obj?, #object?, #regex?, #regexp?, #str?, #string?, #to_boolean, #to_integer, #to_number, #to_object, #to_string, #true?, #undefined?
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 33 |
# File 'ext/v8/v8_date.cpp', line 28
static VALUE rb_v8_date_new(VALUE klass, VALUE time)
{
HandleScope scope;
PREVENT_CREATION_WITHOUT_CONTEXT();
return v8_ref_new(klass, to_v8_date(time));
}
|
Instance Method Details
#<=>(other) ⇒ Object
11 12 13 |
# File 'lib/mustang/v8/date.rb', line 11 def <=>(other) to_time <=> other end |
#delegate ⇒ Object
15 16 17 |
# File 'lib/mustang/v8/date.rb', line 15 def delegate to_time end |
#kind_of?(klass) ⇒ Boolean
19 20 21 |
# File 'lib/mustang/v8/date.rb', line 19 def kind_of?(klass) klass == ::Time or klass == ::Date or klass == ::DateTime or super(klass) end |
#to_i ⇒ Object
Returns integer value representation of referenced v8 date.
42 43 44 45 46 |
# File 'ext/v8/v8_date.cpp', line 42
static VALUE rb_v8_date_to_i(VALUE self)
{
HandleScope scope;
return rb_int_new(unwrap(self)->NumberValue());
}
|
#to_time ⇒ Object
7 8 9 |
# File 'lib/mustang/v8/date.rb', line 7 def to_time Time.at(to_i); end |