Class: V8::Value

Inherits:
Data show all
Defined in:
ext/v8/v8_value.cpp

Direct Known Subclasses

External, Object, Primitive, Regexp

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Data

#error?, #value?

Class Method Details

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

Returns new V8 value reflected from given object.



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

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

Instance Method Details

#===(other_val) ⇒ Boolean

Returns true when compared values are the same objects.



302
303
304
305
306
# File 'ext/v8/v8_value.cpp', line 302

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.



315
316
317
318
319
# File 'ext/v8/v8_value.cpp', line 315

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.



118
119
120
121
122
# File 'ext/v8/v8_value.cpp', line 118

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.



118
119
120
121
122
# File 'ext/v8/v8_value.cpp', line 118

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.



132
133
134
135
136
# File 'ext/v8/v8_value.cpp', line 132

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.



132
133
134
135
136
# File 'ext/v8/v8_value.cpp', line 132

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.



159
160
161
162
163
# File 'ext/v8/v8_value.cpp', line 159

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.



198
199
200
201
202
# File 'ext/v8/v8_value.cpp', line 198

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.



90
91
92
93
94
# File 'ext/v8/v8_value.cpp', line 90

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.



185
186
187
188
189
# File 'ext/v8/v8_value.cpp', line 185

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.



104
105
106
107
108
# File 'ext/v8/v8_value.cpp', line 104

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.



104
105
106
107
108
# File 'ext/v8/v8_value.cpp', line 104

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.



49
50
51
52
53
# File 'ext/v8/v8_value.cpp', line 49

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.



49
50
51
52
53
# File 'ext/v8/v8_value.cpp', line 49

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.



211
212
213
214
215
# File 'ext/v8/v8_value.cpp', line 211

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.



63
64
65
66
67
# File 'ext/v8/v8_value.cpp', line 63

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.



63
64
65
66
67
# File 'ext/v8/v8_value.cpp', line 63

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.



35
36
37
38
39
# File 'ext/v8/v8_value.cpp', line 35

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.



35
36
37
38
39
# File 'ext/v8/v8_value.cpp', line 35

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.



146
147
148
149
150
# File 'ext/v8/v8_value.cpp', line 146

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.



146
147
148
149
150
# File 'ext/v8/v8_value.cpp', line 146

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.



77
78
79
80
81
# File 'ext/v8/v8_value.cpp', line 77

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.



77
78
79
80
81
# File 'ext/v8/v8_value.cpp', line 77

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.



276
277
278
279
280
# File 'ext/v8/v8_value.cpp', line 276

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.



250
251
252
253
254
# File 'ext/v8/v8_value.cpp', line 250

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.



263
264
265
266
267
# File 'ext/v8/v8_value.cpp', line 263

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.



289
290
291
292
293
# File 'ext/v8/v8_value.cpp', line 289

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.



237
238
239
240
241
# File 'ext/v8/v8_value.cpp', line 237

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.



172
173
174
175
176
# File 'ext/v8/v8_value.cpp', line 172

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.



224
225
226
227
228
# File 'ext/v8/v8_value.cpp', line 224

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