2011-03-01 Rubyでプラットフォームを判別する方法 Ruby on Rails Ruby メモメモるびま require "rbconfig" osn = Config::CONFIG["target_os"].downcase @@os = osn =~ /mswin(?!ce)|mingw|cygwin|bccwin/ ? "win" : (osn =~ /linux/ ? "linux" : "other") p @@os Ubuntuでの実行結果 "linux"