Discovering the OS

hi list -

just wondering if there is a way to find out which OS ruby is running on?

for these type of:

if (windows)
  system "start file.html"
else if (mac)
  system "open file.html"
end

···

--
-------------------------------------------
      David "DC" Collier
mailto:dc@pikkle.com
      +81 (0)80 6521 9559
      skype: callto://d3ntaku
-------------------------------------------
      Pikkle 株式会社
      http://www.pikkle.com
-------------------------------------------

dc wrote:

if (windows)
  system "start file.html"
else if (mac)
  system "open file.html"

  else
    puts "Oy, nevermind! You can open it yourself!"

end

hehe

Found this on Google.
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/47795

It looks like Config::CONFIG["arch"] is what you need to be looking at.

···

--
Posted via http://www.ruby-forum.com/\.

try this

   ruby -r rbconfig -r yaml -e' y Config::CONFIG '

-a

···

On Sat, 23 Sep 2006, dc wrote:

hi list -

just wondering if there is a way to find out which OS ruby is running on?

for these type of:

if (windows)
system "start file.html"
else if (mac)
system "open file.html"
end

--
in order to be effective truth must penetrate like an arrow - and that is
likely to hurt. -- wei wu wei

dc wrote:

hi list -

just wondering if there is a way to find out which OS ruby is running
on?

for these type of:

if (windows)
  system "start file.html"
else if (mac)
  system "open file.html"
end

--
-------------------------------------------
      David "DC" Collier
mailto:dc@pikkle.com
      +81 (0)80 6521 9559
      skype: callto://d3ntaku

RUBY_PLATFORM?

RUBY_PLATFORM
The identifier of the platform running this program. This string
is in the same form as the platform identifier used by the GNU
configure utility (which is not a coincidence).

David

···

--
Posted via http://www.ruby-forum.com/\.

David Roberts wrote:

RUBY_PLATFORM
The identifier of the platform running this program. This string
is in the same form as the platform identifier used by the GNU
configure utility (which is not a coincidence).

Spoilsport. Why's Ruby always gotta make things easy? -sigh-

Truly, that's the hardest thing for me to get used to... I'm used to
having to work to find out things like that.

···

--
Posted via http://www.ruby-forum.com/\.

William Crawford schrieb:

dc wrote:

if (windows)

It looks like Config::CONFIG["arch"] is what you need to be looking at.

Hm, what about Config::CONFIG['target_os'] or Config::CONFIG['host_os']?

Kalman