2gua 发表于 2010-12-21 09:49

[技巧]想知道Ruby运行在什么操作系统平台吗?

哈哈哈,今天来个简短点但很酷的技巧:想知道Ruby运行在什么操作系统平台吗?
那就是用RUBY_PLATFORM常量:

puts RUBY_PLATFORM
=> i486-linux

zuerrong 发表于 2010-12-21 10:47

其他预定义常量还包括:

TRUE            The typical true value.
FALSE             The false itself.
NIL               The nil itself.
STDIN             The standard input. The default value for $stdin.
STDOUT            The standard output. The default value for $stdout.
STDERR            The standard error output. The default value for $stderr.
ENV               The hash contains current environment variables.
ARGF            The alias to the $<.
ARGV            The alias to the $*.
DATA            The file object of the script, pointing just after __END__.
RUBY_VERSION      The ruby version string (VERSION was deprecated).
RUBY_RELEASE_DATE The release date string.
RUBY_PLATFORM   The platform identifier.

2gua 发表于 2010-12-21 11:00

祖儿补充得很多了。

southwoody 发表于 2010-12-24 20:19

Ruby在ARM平台上编译也很方便

squirrelRao 发表于 2010-12-25 09:37

:emn23:

ziyiu123 发表于 2011-02-22 19:24

:emn10:

2gua 发表于 2011-02-22 19:27


ziyiu123 发表于 2011-02-22 19:24 http://bbs.chinaunix.net/images/common/back.gif


    你已经灌了很多帖了,要注意。
页: [1]
查看完整版本: [技巧]想知道Ruby运行在什么操作系统平台吗?