January 2024
Intermediate to advanced
718 pages
20h 15m
English
When Ruby is compiled for a particular architecture, all the relevant settings used to build it (including the architecture of the machine on which it was compiled, compiler options, source code directory, and so on) are written to the module RbConfig within the library file rbconfig.rb. After installation, any Ruby program can use this module to get details on how Ruby was compiled:
| | require "rbconfig" |
| | include RbConfig |
| | CONFIG["host"] # => "arm64-apple-darwin23" |
| | CONFIG["libdir"] # => "/Users/noel/.rbenv/versions/3.3.0-dev/lib" |
Extension libraries use this configuration file to compile and link properly on any given architecture.
Read now
Unlock full access