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
28
29
30
31
# File 'ext/v8/v8_value.cpp', line 22

static VALUE rb_v8_value_new(VALUE self, VALUE data)
{
  HandleScope scope;

  if (data != Qtrue && data != Qfalse && data != Qnil) {
    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:



308
309
310
311
312
# File 'ext/v8/v8_value.cpp', line 308

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:



321
322
323
324
325
# File 'ext/v8/v8_value.cpp', line 321

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:



124
125
126
127
128
# File 'ext/v8/v8_value.cpp', line 124

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:



124
125
126
127
128
# File 'ext/v8/v8_value.cpp', line 124

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:



138
139
140
141
142
# File 'ext/v8/v8_value.cpp', line 138

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:



138
139
140
141
142
# File 'ext/v8/v8_value.cpp', line 138

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:



165
166
167
168
169
# File 'ext/v8/v8_value.cpp', line 165

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:



204
205
206
207
208
# File 'ext/v8/v8_value.cpp', line 204

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:



96
97
98
99
100
# File 'ext/v8/v8_value.cpp', line 96

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:



191
192
193
194
195
# File 'ext/v8/v8_value.cpp', line 191

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:



110
111
112
113
114
# File 'ext/v8/v8_value.cpp', line 110

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:



110
111
112
113
114
# File 'ext/v8/v8_value.cpp', line 110

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:



55
56
57
58
59
# File 'ext/v8/v8_value.cpp', line 55

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:



55
56
57
58
59
# File 'ext/v8/v8_value.cpp', line 55

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:



217
218
219
220
221
# File 'ext/v8/v8_value.cpp', line 217

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:



69
70
71
72
73
# File 'ext/v8/v8_value.cpp', line 69

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:



69
70
71
72
73
# File 'ext/v8/v8_value.cpp', line 69

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:



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

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:



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

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:



152
153
154
155
156
# File 'ext/v8/v8_value.cpp', line 152

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:



152
153
154
155
156
# File 'ext/v8/v8_value.cpp', line 152

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:



83
84
85
86
87
# File 'ext/v8/v8_value.cpp', line 83

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:



83
84
85
86
87
# File 'ext/v8/v8_value.cpp', line 83

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:



282
283
284
285
286
# File 'ext/v8/v8_value.cpp', line 282

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:



256
257
258
259
260
# File 'ext/v8/v8_value.cpp', line 256

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)


269
270
271
272
273
# File 'ext/v8/v8_value.cpp', line 269

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:



295
296
297
298
299
# File 'ext/v8/v8_value.cpp', line 295

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:



243
244
245
246
247
# File 'ext/v8/v8_value.cpp', line 243

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:



178
179
180
181
182
# File 'ext/v8/v8_value.cpp', line 178

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:



230
231
232
233
234
# File 'ext/v8/v8_value.cpp', line 230

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