Class SysInfo
In: lib/sysinfo.rb
Parent: Storable

SysInfo

A container for the platform specific system information. Portions of this code were originally from Amazon‘s EC2 AMI tools, specifically lib/platform.rb.

Methods

Constants

VERSION = "0.7.3".freeze
IMPLEMENTATIONS = [ # These are for JRuby, System.getproperty('os.name'). # For a list of all values, see: http://lopica.sourceforge.net/os.html #regexp matcher os implementation [/mac\s*os\s*x/i, :unix, :osx ], [/sunos/i, :unix, :solaris ], [/windows\s*ce/i, :windows, :wince ], [/windows/i, :windows, :windows ], [/osx/i, :unix, :osx ], # These are for RUBY_PLATFORM and JRuby [/java/i, :java, :java ], [/darwin/i, :unix, :osx ], [/linux/i, :unix, :linux ], [/freebsd/i, :unix, :freebsd ], [/netbsd/i, :unix, :netbsd ], [/solaris/i, :unix, :solaris ], [/irix/i, :unix, :irix ], [/cygwin/i, :unix, :cygwin ], [/mswin/i, :windows, :windows ], [/djgpp/i, :windows, :djgpp ], [/mingw/i, :windows, :mingw ], [/bccwin/i, :windows, :bccwin ], [/wince/i, :windows, :wince ], [/vms/i, :vms, :vms ], [/os2/i, :os2, :os2 ], [nil, :unknown, :unknown ], ].freeze
ARCHITECTURES = [ [/(i\d86)/i, :x86 ], [/x86_64/i, :x86_64 ], [/x86/i, :x86 ], # JRuby [/ia64/i, :ia64 ], [/alpha/i, :alpha ], [/sparc/i, :sparc ], [/mips/i, :mips ], [/powerpc/i, :powerpc ], [/universal/i,:x86_64 ], [nil, :unknown ], ].freeze

External Aliases

impl -> implementation
arch -> architecture

Public Class methods

Public Instance methods

Return the hostname for the local machine

Return the local IP address which receives external traffic from: coderrr.wordpress.com/2008/05/28/get-your-local-ip-address/ NOTE: This does not open a connection to the IP address.

Returns [hostname, ipaddr (internal), uptime]

Returns [vm, os, impl, arch]

Returns the local uptime in hours. Use Win32API in Windows, ‘sysctl -b kern.boottime’ os osx, and ‘who -b’ on unix. Based on Ruby Quiz solutions by: Matthias Reitinger On Windows, see also: net statistics server

Returns the path to the current user‘s home directory

Returns the environment paths as an Array

Returns a Symbol of the short platform descriptor in the format: VM-OS e.g. :java-unix

Returns the name of the current shell

Returns the path to the current temp directory

Returns a String of the full platform descriptor in the format: VM-OS-IMPL-ARCH e.g. java-unix-osx-x86_64

[Validate]