OS Integration

Ruby is a cross-platform language, meaning it runs on most operating systems. Ruby is not unique in this regard, but Ruby goes a step further in being generally operating-system independent as well. With comparatively few exceptions, code written for one system will work on another, without modification. The primary exceptions involve files and directories. This should be expected, as Windows, Mac OS X, Unix, and Linux all organize files and directories in different ways.

To determine the operating system in use, look at the RUBY_PLATFORM constant. It’s a string that indicates both the operating system and the hardware on which it’s running. This value won’t be as simple as just Windows or Mac: on my Intel Mac, it’s universal-darwin9.0 ...

Get Ruby: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.