rubyで自分のIPアドレスを取得 require 'socket' Socket.getaddrinfo(Socket::gethostname, nil, Socket::AF_INET)[0][3]