How can I make rdoc correctly read method arguments from my c extension?

that's it, I use rdoc to create documentation for my Ruby code that contains C extensions, but I am having problems with method arguments. Rdoc parses its names incorrectly and instead uses p1, p2, etc.

So, firstly, my extensions are actually compiled as C ++, so I have to use function definitions that look like this:

static VALUE 
MyMethod(VALUE self, VALUE flazm, VALUE saszm)
{
    return Qnil;
}

Rdoc seems to be expecting an old-style definition of "C" as follows:

static VALUE
MyMethod(self, flazm, saszm)
    VALUE self;
    VALUE flazm;
    VALUE saszm;
{
    return Qnil;
}

Anyway, can I do this job?

+3
source share
1 answer

RDoc C- *. RDoc :

meth_obj.params = "(" + (1..p_count).map{|i| "p#{i}"}.join(", ") + ")"

.

, call-seq. , method(p1, p2) .

/*
 * call-seq:
 *   my_method(flazm, saszm) -> nil
 *   my_method(bunny) { |fluffy_ears| ... } -> true or false
 *
 * Method description here.
 */
static VALUE 
MyMethod(VALUE self, VALUE flazm, VALUE saszm)
{
    return Qnil;
}

* . Regex " " .

+3

Source: https://habr.com/ru/post/1711042/


All Articles