2

I've been working on some ruby libraries with C extensions now. And I want to give users access to the irb#help method, e.g:

> help("Array#empty?")
# Prints documentation for the method.

I've been using the same way to name functions as ruby core, and the same documentation pattern. However, irb always tell me that there is Nothing known about FastPolyline.decode.

Here's my method:

/*
 * call-seq:
 *   FastPolylines.decode([[1,1]]) -> String
 *
 * Decodes a polyline.
 */
static VALUE
decode(int argc, VALUE *argv, VALUE self) {

I've tried naming the method various ways, such as rb_FastPolylines__decode, rb_fast_polylines_decode, rb_decode. None worked..

I've been looking on internet, but couldn't find any convincing resource on How to document a ruby C extension. Do you have any inputs on this ?

Ulysse BN
  • 10,116
  • 7
  • 54
  • 82
  • 1
    Maybe this hay help? https://github.com/sparklemotion/nokogiri/blob/52ebbd7b28d32aaa27b0d5f59e35804ebe7ed126/Rakefile#L35 – DNNX Nov 11 '20 at 12:10
  • Also, are you sure you are installing your library with `rdoc`? Can it be that you have `--no-rdoc` or `--no-document` in your .gemrc? If you add documentation to a pure ruby class or method in the gem, is it available in `help`? – DNNX Nov 11 '20 at 12:14
  • @DNNX, thanks, this has changed a bit, now I have an empty documentation. Which is already much better ! However, It doesn't give the text I've added... About the second question, rdoc is on on my laptop :) – Ulysse BN Nov 11 '20 at 15:47

0 Answers0