How can I get the host name for the machine I'm running on from Ruby code?
I don't want to exec a Unix command to do this because I want it to
also work under Windows.
I want this for building a server URL that I'll be using with drb.
I don't want to hardcode a host name.
···
--
R. Mark Volkmann
Partner, Object Computing, Inc.
Mark Volkmann wrote:
How can I get the host name for the machine I'm running on from Ruby code?
I don't want to exec a Unix command to do this because I want it to
also work under Windows.
I want this for building a server URL that I'll be using with drb.
I don't want to hardcode a host name.
require "socket"
puts Socket.gethostname
Regards,
Dan