Class: Rubydex::Document

Inherits:
Object
  • Object
show all
Defined in:
ext/rubydex/document.c

Instance Method Summary collapse

Constructor Details

#initializeObject

Instance Method Details

#definitionsEnumerator[Rubydex::Definition]

Returns an enumerator that yields all definitions for this document lazily.

Returns:



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'ext/rubydex/document.c', line 73

static VALUE rdxr_document_definitions(VALUE self) {
    if (!rb_block_given_p()) {
        return rb_enumeratorize_with_size(self, rb_str_new2("definitions"), 0, NULL, document_definitions_size);
    }

    HandleData *data;
    void *graph = rdxi_graph_from_handle(self, &data);
    void *iter = rdx_document_definitions_iter_new(graph, data->id);
    VALUE args = rb_ary_new_from_args(2, self, ULL2NUM((uintptr_t)iter));
    rb_ensure(document_definitions_yield, args, document_definitions_ensure, args);

    return self;
}

#method_referencesObject

Returns an enumerator that yields all method references for this document lazily



100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'ext/rubydex/document.c', line 100

static VALUE rdxr_document_method_references(VALUE self) {
    if (!rb_block_given_p()) {
        return rb_enumeratorize_with_size(self, rb_str_new2("method_references"), 0, NULL,
                                          document_method_references_size);
    }

    HandleData *data;
    void *graph = rdxi_graph_from_handle(self, &data);
    void *iter = rdx_document_method_references_iter_new(graph, data->id);
    VALUE args = rb_ary_new_from_args(2, data->graph_obj, ULL2NUM((uintptr_t)iter));
    rb_ensure(rdxi_method_references_yield, args, rdxi_method_references_ensure, args);

    return self;
}

#uriString?

Returns the document URI.

Returns:

  • (String?)


21
22
23
24
25
26
27
# File 'ext/rubydex/document.c', line 21

static VALUE rdxr_document_uri(VALUE self) {
    HandleData *data;
    void *graph = rdxi_graph_from_handle(self, &data);
    const char *uri = rdx_document_uri(graph, data->id);

    return rdxi_owned_c_string_to_ruby(uri);
}