C for Rubyists
omniref.com
omniref.com
Also of interest might be this series of blog posts currently being written: Reconstructing Ruby in C [0]
[0] http://www.halogenandtoast.com/reconstructing-ruby-our-first...
Here's an example using RubyInline, which is a gem that handles the compilation step for you:
I always imagined that ruby and c were worlds apart, and that it took a crazy level of mastery to make them work together.
That thought led me to this article about embedding rust in ruby
For anyone intersted how Ruby parser works, I've written small article about patching ruby syntax: https://zarkzork.com/extending-ruby.html
Very neat.
That said, there are some neat things I've seen in the ruby C code in the past. I thought [1] was pretty clever (this pattern shows up several times in the ruby source) the first time I saw it, since it lets you access the members of the union like `foo->as.thing`, which is fairly pretty IMO.
[1] https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#...
If you don't see anything, try disabling social-blocking extensions.
Update: I've got a fix for this going out now. Let me know if it's still broken.