get system name in ruby

To get the system name in Ruby, you can use the Socket module and the gethostname method. Here's an example:

main.rb
require 'socket'

puts Socket.gethostname
42 chars
4 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