A quick and easy template for a Ruby Extension.
tangphillip/Ruby-Extension-Tutorial
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main
Could not load branches
Nothing to show
Could not load tags
Nothing to show
{{ refName }}
default
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
-
Clone
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more about the CLI.
- Open with GitHub Desktop
- Download ZIP
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
This is a quick guide to making an extension to Ruby. 0. Download this skeleton of your extension. Unzip it into an empty folder. 1. Read _build.sh_, which is a short bash script that shows you how to build your extension. 2. Read _extconf.rb_, which is the extension configuration script. 3. The datatype `VALUE` represents EVERYTHING in Ruby. You'll need to decode your data in order to work with it in C, and re-encode everything in order to return it to Ruby. 4. When you call a C function from Ruby, the first argument is the receiver of the method, a `VALUE` called `self`. Basically, if you want a two-argument Ruby function, you'll need three arguments in the C version of it. 5. Read _yourextension.c_. It outlines the main steps in a simple Ruby extension. 6. If you want to know more about how extensions work under the hood, or if something isn't abundantly clear from the file, read the ruby-docs! http://ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html!
About
A quick and easy template for a Ruby Extension.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published