Class: QML::Engine
- Inherits:
-
Object
- Object
- QML::Engine
- Defined in:
- lib/qml/engine.rb,
lib/qml/engine.rb,
ext/qml/engine.c
Overview
Engine provides a QML engine.
Instance Method Summary collapse
-
#add_import_path(path) ⇒ Object
Adds a QML import path to the Engine.
-
#collect_garbage ⇒ Object
Starts garbage collection on the Engine.
-
#evaluate(str, file = '<in QML::Engine#evaluate>', lineno = 1) ⇒ Object
Evaluates an JavaScript expression.
- #new_array(len) ⇒ QML::JSArray
- #new_object ⇒ QML::JSObject
Instance Method Details
#add_import_path(path) ⇒ Object
Adds a QML import path to the QML::Engine.
49 50 51 52 53 54 |
# File 'ext/qml/engine.c', line 49
static VALUE engine_add_import_path(VALUE self, VALUE path) {
qmlbind_engine engine = rbqml_get_engine(self);
path = rb_funcall(path, rb_intern("to_s"), 0);
qmlbind_engine_add_import_path(engine, rb_string_value_cstr(&path));
return self;
}
|
#collect_garbage ⇒ Object
Starts garbage collection on the QML::Engine.
115 116 117 118 119 |
# File 'ext/qml/engine.c', line 115 static VALUE engine_collect_garbage(VALUE self) { qmlbind_engine engine = rbqml_get_engine(self); qmlbind_engine_collect_garbage(engine); return self; } |
#evaluate(str, file = '<in QML::Engine#evaluate>', lineno = 1) ⇒ Object
Evaluates an JavaScript expression
13 14 15 16 17 |
# File 'lib/qml/engine.rb', line 13 def evaluate(str, file = '<in QML::Engine#evaluate>', lineno = 1) evaluate_impl(str, file, lineno).tap do |result| raise result.to_error if result.is_a?(JSObject) && result.error? end end |
#new_array(len) ⇒ QML::JSArray
89 90 91 92 93 94 95 96 97 |
# File 'ext/qml/engine.c', line 89
static VALUE engine_new_array(VALUE self, VALUE len) {
qmlbind_engine engine = rbqml_get_engine(self);
qmlbind_value array = qmlbind_engine_new_array(engine, NUM2INT(len));
VALUE value = rbqml_js_object_new(rbqml_cJSArray, array);
qmlbind_value_release(array);
return value;
}
|
#new_object ⇒ QML::JSObject
102 103 104 105 106 107 108 109 110 |
# File 'ext/qml/engine.c', line 102 static VALUE engine_new_object(VALUE self) { qmlbind_engine engine = rbqml_get_engine(self); qmlbind_value obj = qmlbind_engine_new_object(engine); VALUE value = rbqml_js_object_new(rbqml_cJSObject, obj); qmlbind_value_release(obj); return value; } |