January 2024
Intermediate to advanced
718 pages
20h 15m
English
You can access operating system environment variables using the predefined variable ENV. It responds to the same methods as Hash. Technically, ENV isn’t actually a hash—it’s a separate class—but if you need to, you can convert it into a Hash using ENV#to_h.
| | ENV['SHELL'] |
| | ENV['HOME'] |
| | ENV['USER'] |
| | ENV.keys.size |
| | ENV.keys[0, 4] |
The values of some environment variables are read by Ruby when it first starts. These variables modify the behavior of the interpreter. Some of the environment variables used by Ruby are listed in the table shown.
| Variable Name | Description |
|---|---|
|
DLN_LIBRARY_PATH |
Specifies the search path for dynamically loaded modules. ... |
Read now
Unlock full access