class Object
Public Instance Methods
arch()
click to toggle source
Host CPU architecture
# File lib/runtime_info.rb, line 16 def arch; Config::CONFIG['host_cpu']; end
cpu_architecture()
click to toggle source
# File lib/runtime_info.rb, line 17 def cpu_architecture; arch; end
cpu_count()
click to toggle source
# File lib/runtime_info.rb, line 30 def cpu_count; ncpus; end
engine()
click to toggle source
Ruby virtual machine in use
# File lib/runtime_info.rb, line 38 def engine return RUBY_ENGINE if defined? RUBY_ENGINE 'ruby' end
ncpus()
click to toggle source
Number of physical CPU cores
# File lib/runtime_info.rb, line 20 def ncpus case os when 'darwin' Integer(`hwprefs cpu_count`) when 'linux' cores = File.read("/proc/cpuinfo").scan(/core id\s+: \d+/).uniq.size cores > 0 ? cores : 1 else raise "don't know how to determine CPU count on #{os}" end end
os()
click to toggle source
Host OS
# File lib/runtime_info.rb, line 33 def os Config::CONFIG['host_os'][/^[A-Za-z]+/] end
path()
click to toggle source
Path to the Ruby interpreter currently in use
# File lib/runtime_info.rb, line 54 def path; Gem.ruby; end
version()
click to toggle source
Version of the Ruby virtual machine in use
# File lib/runtime_info.rb, line 44 def version case engine when 'ruby' then RUBY_VERSION when 'jruby' then JRUBY_VERSION when 'rbx' then Rubinius::VERSION else raise "don't know how to obtain version for #{engine}" end end