Checking the name of the host Operating System

Hey Guys,

Anyone know how I can determine the name of the host operating system
from within Ruby?

Sonny.

On Feb 13, 2007, at 2:07 PM, Sonny C. wrote:

Hey Guys,

Anyone know how I can determine the name of the host operating system
from within Ruby?

Sure:

RUBY_PLATFORM
=> “i686-darwin8.8.1”

require “rbconfig”
=> false

Config::CONFIG[“target”]
=> “i686-apple-darwin8.8.1”

Config::CONFIG[“arch”]
=> “i686-darwin8.8.1”

Config::CONFIG[“target_os”]
=> “darwin8.8.1”

Hope that helps.

James Edward G. II

Thanks James, that’s exactly what I need.

Sonny.

James G. wrote:

On Feb 13, 2007, at 2:07 PM, Sonny C. wrote:

Hey Guys,

Anyone know how I can determine the name of the host operating system
from within Ruby?

Sure:

RUBY_PLATFORM
=> “i686-darwin8.8.1”

require “rbconfig”
=> false

Config::CONFIG[“target”]
=> “i686-apple-darwin8.8.1”

Config::CONFIG[“arch”]
=> “i686-darwin8.8.1”

Config::CONFIG[“target_os”]
=> “darwin8.8.1”

Hope that helps.

James Edward G. II

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs