SIGN IN SIGN UP

Protocol Buffers - Google's data interchange format

0 0 2 C++

Add Ruby files for documentation purposes (#21212)

Partial fix for #21092 .

This adds a number of Ruby files to the `lib/docs` directory. These files are not actually required by the Protobuf gem, so they should not affect any functionality. They are only there to key off of the auto-generation by [https://www.rubydoc.info](https://www.rubydoc.info) .

For now I've left the comments in the C and Java code. However, they duplicate what I have there (since I largely copy/pasted the English content from those comments). One thing we could do is change the comments to reference the Ruby files, e.g.:

```c
/*
 * See documentation: ../../../lib/stubs/descriptor_pool#lookup
 */
static VALUE DescriptorPool_lookup(VALUE _self, VALUE name) {
```

I can make those changes if approved.

This PR does *not* include files generated by Protobuf from `.proto` files. That means that references to things like `ServiceDescriptorProto` don't go anywhere. I can look at generating similar files to this via a protoc plugin, although it'd be a bit in-depth. Or I could do it by hand of course :)

Note that the [current rubydocs](https://www.rubydoc.info/gems/google-protobuf) does have some entries, but they are mostly from the FFI implementation and are kind of an "accident". My PR specifies the files to generate should *only* come from the `lib/docs` folder.

Feedback welcome!

Closes #21212

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/21212 from dorner:ruby-doc 9cc3613339c35ef0ad67f166420f8e00e852f864
PiperOrigin-RevId: 768309166
D
Daniel Orner committed
5e3dd3d6bc445fdc58f8a42e28db01a75d0c4166
Parent: d5adcad
Committed by Copybara-Service <copybara-worker@google.com> on 6/7/2025, 2:11:48 AM