[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

discovering the OS

d c

9/22/2006 4:35:00 PM

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....
-------------------------------------------

5 Answers

William Crawford

9/22/2006 4:57:00 PM

0

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-...

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

--
Posted via http://www.ruby-....

Ara.T.Howard

9/22/2006 4:58:00 PM

0

David Roberts

9/22/2006 5:02:00 PM

0

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-....

Kalman Noel

9/22/2006 5:09:00 PM

0

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

William Crawford

9/22/2006 5:11:00 PM

0

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-....