To get the system name in Ruby, you can use the Socket
module and the gethostname
method. Here's an example:
main.rb42 chars4 lines
This will output the name of the system running the Ruby program. Note that this method returns the hostname, not the operating system name.
gistlibby LogSnag