Class: Mustang::V8::Value

Inherits:
V8Data
  • Object
show all
Defined in:
ext/v8/v8_value.cpp

Direct Known Subclasses

Date, External, Object, Primitive, Regexp

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.V8::Value.new(obj) ⇒ Object

Returns new V8 value reflected from given object.



22
23
24
25
26
27
# File 'ext/v8/v8_value.cpp', line 22

static VALUE rb_v8_value_new(VALUE self, VALUE data)
{
  HandleScope scope; 
  PREVENT_CREATION_WITHOUT_CONTEXT();
  return v8_ref_new(self, to_v8(data));
}

Instance Method Details

#===(other_val) ⇒ Boolean

Returns true when compared values are the same objects.

Returns:

  • (Boolean)


304
305
306
307
308
# File 'ext/v8/v8_value.cpp', line 304

static VALUE rb_v8_value_equals(VALUE self, VALUE value)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->Equals(to_v8(value)));
}

#==(other_val) ⇒ Boolean

Returns true when compared values are equal.

Returns:

  • (Boolean)


317
318
319
320
321
# File 'ext/v8/v8_value.cpp', line 317

static VALUE rb_v8_value_strict_equals(VALUE self, VALUE value)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->StrictEquals(to_v8(value)));
}

#array?Boolean #ary?Boolean

Returns true when value is a javascipt array.

Overloads:

  • #array?Boolean

    Returns:

    • (Boolean)
  • #ary?Boolean

    Returns:

    • (Boolean)


120
121
122
123
124
# File 'ext/v8/v8_value.cpp', line 120

static VALUE rb_v8_value_array_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsArray());
}

#array?Boolean #ary?Boolean

Returns true when value is a javascipt array.

Overloads:

  • #array?Boolean

    Returns:

    • (Boolean)
  • #ary?Boolean

    Returns:

    • (Boolean)


120
121
122
123
124
# File 'ext/v8/v8_value.cpp', line 120

static VALUE rb_v8_value_array_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsArray());
}

#boolean?Boolean #bool?Boolean

Returns true when value is a javascipt boolean.

Overloads:

  • #boolean?Boolean

    Returns:

    • (Boolean)
  • #bool?Boolean

    Returns:

    • (Boolean)


134
135
136
137
138
# File 'ext/v8/v8_value.cpp', line 134

static VALUE rb_v8_value_boolean_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsBoolean());
}

#boolean?Boolean #bool?Boolean

Returns true when value is a javascipt boolean.

Overloads:

  • #boolean?Boolean

    Returns:

    • (Boolean)
  • #bool?Boolean

    Returns:

    • (Boolean)


134
135
136
137
138
# File 'ext/v8/v8_value.cpp', line 134

static VALUE rb_v8_value_boolean_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsBoolean());
}

#date?Boolean

Returns true when value is a javascipt date.

Returns:

  • (Boolean)


161
162
163
164
165
# File 'ext/v8/v8_value.cpp', line 161

static VALUE rb_v8_value_date_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsDate());
}

#empty?Boolean

Returns true when value is empty.

Returns:

  • (Boolean)


200
201
202
203
204
# File 'ext/v8/v8_value.cpp', line 200

static VALUE rb_v8_value_empty_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self).IsEmpty());
}

#external?Boolean

Returns true when value is a v8 external value.

Returns:

  • (Boolean)


92
93
94
95
96
# File 'ext/v8/v8_value.cpp', line 92

static VALUE rb_v8_value_external_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsExternal());
}

#false?Boolean

Returns true when value is a javascipt bool false.

Returns:

  • (Boolean)


187
188
189
190
191
# File 'ext/v8/v8_value.cpp', line 187

static VALUE rb_v8_value_false_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsFalse());
}

#function?Boolean #func?Boolean

Returns true when value is a javascipt function.

Overloads:

  • #function?Boolean

    Returns:

    • (Boolean)
  • #func?Boolean

    Returns:

    • (Boolean)


106
107
108
109
110
# File 'ext/v8/v8_value.cpp', line 106

static VALUE rb_v8_value_function_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsFunction());
}

#function?Boolean #func?Boolean

Returns true when value is a javascipt function.

Overloads:

  • #function?Boolean

    Returns:

    • (Boolean)
  • #func?Boolean

    Returns:

    • (Boolean)


106
107
108
109
110
# File 'ext/v8/v8_value.cpp', line 106

static VALUE rb_v8_value_function_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsFunction());
}

#integer?Boolean #int?Boolean

Returns true when value is a javascipt integer.

Overloads:

  • #integer?Boolean

    Returns:

    • (Boolean)
  • #int?Boolean

    Returns:

    • (Boolean)


51
52
53
54
55
# File 'ext/v8/v8_value.cpp', line 51

static VALUE rb_v8_value_integer_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsInt32() || unwrap(self)->IsUint32());
}

#integer?Boolean #int?Boolean

Returns true when value is a javascipt integer.

Overloads:

  • #integer?Boolean

    Returns:

    • (Boolean)
  • #int?Boolean

    Returns:

    • (Boolean)


51
52
53
54
55
# File 'ext/v8/v8_value.cpp', line 51

static VALUE rb_v8_value_integer_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsInt32() || unwrap(self)->IsUint32());
}

#null?Boolean

Returns true when value is a javascipt null.

Returns:

  • (Boolean)


213
214
215
216
217
# File 'ext/v8/v8_value.cpp', line 213

static VALUE rb_v8_value_null_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsNull());
}

#number?Boolean #num?Boolean

Returns true when value is a javascipt floating point number.

Overloads:

  • #number?Boolean

    Returns:

    • (Boolean)
  • #num?Boolean

    Returns:

    • (Boolean)


65
66
67
68
69
# File 'ext/v8/v8_value.cpp', line 65

static VALUE rb_v8_value_number_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsNumber());
}

#number?Boolean #num?Boolean

Returns true when value is a javascipt floating point number.

Overloads:

  • #number?Boolean

    Returns:

    • (Boolean)
  • #num?Boolean

    Returns:

    • (Boolean)


65
66
67
68
69
# File 'ext/v8/v8_value.cpp', line 65

static VALUE rb_v8_value_number_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsNumber());
}

#object?Boolean #obj?Boolean

Returns true when value is a javascipt object.

Overloads:

  • #object?Boolean

    Returns:

    • (Boolean)
  • #obj?Boolean

    Returns:

    • (Boolean)


37
38
39
40
41
# File 'ext/v8/v8_value.cpp', line 37

static VALUE rb_v8_value_object_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsObject());
}

#object?Boolean #obj?Boolean

Returns true when value is a javascipt object.

Overloads:

  • #object?Boolean

    Returns:

    • (Boolean)
  • #obj?Boolean

    Returns:

    • (Boolean)


37
38
39
40
41
# File 'ext/v8/v8_value.cpp', line 37

static VALUE rb_v8_value_object_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsObject());
}

#regexp?Boolean #regex?Boolean

Returns true when value is a javascipt regexp.

Overloads:

  • #regexp?Boolean

    Returns:

    • (Boolean)
  • #regex?Boolean

    Returns:

    • (Boolean)


148
149
150
151
152
# File 'ext/v8/v8_value.cpp', line 148

static VALUE rb_v8_value_regexp_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsRegExp());
}

#regexp?Boolean #regex?Boolean

Returns true when value is a javascipt regexp.

Overloads:

  • #regexp?Boolean

    Returns:

    • (Boolean)
  • #regex?Boolean

    Returns:

    • (Boolean)


148
149
150
151
152
# File 'ext/v8/v8_value.cpp', line 148

static VALUE rb_v8_value_regexp_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsRegExp());
}

#string?Boolean #str?Boolean

Returns true when value is a javascipt string.

Overloads:

  • #string?Boolean

    Returns:

    • (Boolean)
  • #str?Boolean

    Returns:

    • (Boolean)


79
80
81
82
83
# File 'ext/v8/v8_value.cpp', line 79

static VALUE rb_v8_value_string_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsString());
}

#string?Boolean #str?Boolean

Returns true when value is a javascipt string.

Overloads:

  • #string?Boolean

    Returns:

    • (Boolean)
  • #str?Boolean

    Returns:

    • (Boolean)


79
80
81
82
83
# File 'ext/v8/v8_value.cpp', line 79

static VALUE rb_v8_value_string_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsString());
}

#to_booleanBoolean

Returns bool representation of this value.

Returns:

  • (Boolean)


278
279
280
281
282
# File 'ext/v8/v8_value.cpp', line 278

static VALUE rb_v8_value_to_boolean(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->ToBoolean());
}

#to_integerInteger

Returns integer representation of this value.

Returns:



252
253
254
255
256
# File 'ext/v8/v8_value.cpp', line 252

static VALUE rb_v8_value_to_integer(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->ToInteger());
}

#to_numberNumeric

Returns number representation of this value.

Returns:

  • (Numeric)


265
266
267
268
269
# File 'ext/v8/v8_value.cpp', line 265

static VALUE rb_v8_value_to_number(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->ToNumber());
}

#to_objectObject

Returns object representation of this value.

Returns:



291
292
293
294
295
# File 'ext/v8/v8_value.cpp', line 291

static VALUE rb_v8_value_to_object(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->ToObject());
}

#to_stringString

Returns string representation of this value.

Returns:



239
240
241
242
243
# File 'ext/v8/v8_value.cpp', line 239

static VALUE rb_v8_value_to_string(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->ToString());
}

#true?Boolean

Returns true when value is a javascipt bool true.

Returns:

  • (Boolean)


174
175
176
177
178
# File 'ext/v8/v8_value.cpp', line 174

static VALUE rb_v8_value_true_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsTrue());
}

#undefined?Boolean

Returns true when value is undefined.

Returns:

  • (Boolean)


226
227
228
229
230
# File 'ext/v8/v8_value.cpp', line 226

static VALUE rb_v8_value_undefined_p(VALUE self)
{
  HandleScope scope;
  return to_ruby(unwrap(self)->IsUndefined());
}