uname.rb provides Ruby bindings for uname(3).
The "uname" method is implemented on Ruby's Kernel module, and it can be called with Kernel as an explicit receiver, or without an explicit receiver in contexts where self inherits from Object. The following example was run on FreeBSD 14-STABLE:
require "uname"
uname = Kernel.uname
print "class = " , uname.class , "\n"
print "sysname = " , uname.sysname , "\n"
print "nodename = " , uname.nodename , "\n"
print "release = " , uname.release , "\n"
print "version = " , uname.version , "\n"
print "machine = " , uname.machine , "\n"
##
# class = UNIXName
# sysname = FreeBSD
# nodename = freebsd.local
# release = 14.0-STABLE-HBSD
# version = FreeBSD 14.0-STABLE-HBSD #0 ...
# machine = amd64
A complete API reference is available at 0x1eef.github.io/x/uname.rb.
Rubygems.org
uname.rb can be installed via rubygems.org.
gem install uname.rb
BSD Zero Clause.
See LICENSE.