Class: QML::JSFunction

Inherits:
JSObject show all
Defined in:
ext/qml/js_function.c

Instance Method Summary collapse

Methods inherited from JSObject

#==, #[], #[]=, #each_pair, #error?, #has_key?, #keys, #method_missing, #respond_to?, #to_error, #to_hash, #to_qml, #to_time, #values

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class QML::JSObject

Instance Method Details

#call(*args) ⇒ Object


68
69
70
71
72
73
74
75
76
77
# File 'ext/qml/js_function.c', line 68

static VALUE js_function_call(int argc, VALUE *argv, VALUE self) {
    VALUE args;
    VALUE block;
    rb_scan_args(argc, argv, "*&", &args, &block);
    if (!NIL_P(block)) {
        args = rb_ary_concat(args, rb_ary_new_from_args(1, block));
    }

    return function_call(self, Qnil, args, CallFunction);
}

#call_with_instance(*args) ⇒ Object


90
91
92
93
94
95
96
97
98
99
100
# File 'ext/qml/js_function.c', line 90

static VALUE js_function_call_with_instance(int argc, VALUE *argv, VALUE self) {
    VALUE thisValue;
    VALUE args;
    VALUE block;
    rb_scan_args(argc, argv, "1*&", &thisValue, &args, &block);
    if (!NIL_P(block)) {
        args = rb_ary_concat(args, rb_ary_new_from_args(1, block));
    }

    return function_call(self, thisValue, args, CallMethod);
}

#new(*args) ⇒ Object


79
80
81
82
83
84
85
86
87
88
# File 'ext/qml/js_function.c', line 79

static VALUE js_function_new(int argc, VALUE *argv, VALUE self) {
    VALUE args;
    VALUE block;
    rb_scan_args(argc, argv, "*&", &args, &block);
    if (!NIL_P(block)) {
        args = rb_ary_concat(args, rb_ary_new_from_args(1, block));
    }

    return function_call(self, Qnil, args, CallConstructor);
}