[技巧]想知道Ruby运行在什么操作系统平台吗?
哈哈哈,今天来个简短点但很酷的技巧:想知道Ruby运行在什么操作系统平台吗?那就是用RUBY_PLATFORM常量:
puts RUBY_PLATFORM
=> i486-linux 其他预定义常量还包括:
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. 祖儿补充得很多了。 Ruby在ARM平台上编译也很方便 :emn23: :emn10:
ziyiu123 发表于 2011-02-22 19:24 http://bbs.chinaunix.net/images/common/back.gif
你已经灌了很多帖了,要注意。
页:
[1]