Skip to content


djberg96 edited this page · 2 revisions
Clone this wiki locally


The sys-host library provides various bits of information about your host.


  require 'sys/host'
  include Sys

  p Host.hostname
  p Host.ip_addr
  p Host.host_id

  # Some platforms{ |h|
    p h



Returns the current version number of this library (as a string)

Singleton Methods


Returns the hostname of the current host. This may or not return the FQDN, depending on your system.


Returns a list of IP addresses for the current host (yes, it is possible to have more than one).{ |h| … }

Yields a HostInfo struct for each network adapter on ‘host’, or an array of HostInfo struct’s in non-block form. The exact members of this struct vary depending on your platform.


Returns the unique hexadecimal identifier for the current host.

Exception Classes

Host::Error < StandardError

Raised in the event of a failure for any of the class methods provided with this library. Generally speaking, it means there was a failure in the underlying gethostname() or gethostbyname() calls.

Something went wrong with that request. Please try again.