Class: Rubydex::MethodReference

Inherits:
Reference show all
Defined in:
ext/rubydex/reference.c

Instance Method Summary collapse

Constructor Details

#initializeObject

Instance Method Details

#locationObject

MethodReference#location -> Rubydex::Location



65
66
67
68
69
70
71
72
73
74
75
76
# File 'ext/rubydex/reference.c', line 65

static VALUE rdxr_method_reference_location(VALUE self) {
    HandleData *data;
    TypedData_Get_Struct(self, HandleData, &handle_type, data);

    void *graph;
    TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);

    Location *loc = rdx_method_reference_location(graph, data->id);
    VALUE location = rdxi_build_location_value(loc);
    rdx_location_free(loc);
    return location;
}

#nameObject

MethodReference#name -> String



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'ext/rubydex/reference.c', line 47

static VALUE rdxr_method_reference_name(VALUE self) {
    HandleData *data;
    TypedData_Get_Struct(self, HandleData, &handle_type, data);

    void *graph;
    TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);

    const char *name = rdx_method_reference_name(graph, data->id);
    if (name == NULL) {
        return Qnil;
    }

    VALUE str = rb_utf8_str_new_cstr(name);
    free_c_string(name);
    return str;
}