I am writing a small CGI script in Ruby, which logs the data of visitors. I would like to log all CGI environment variables like REMOTE_ADDR, USER_AGENT, HTTP_REFERER etc. It was quite easy to iterate over the $_ENV array in PHP, and dump all the variables to examine them, but how can I do this in Ruby?
Asked
Active
Viewed 71 times
2
-
1possible duplicate of [How to get ip address, referer, and user agent in ruby?](http://stackoverflow.com/questions/6701577/how-to-get-ip-address-referer-and-user-agent-in-ruby) – Aleksei Matiushkin Mar 02 '15 at 16:27
1 Answers
0
Try: ENV.inspect
It seems to be a hash that holds what you are looking for.

Jikku Jose
- 18,306
- 11
- 41
- 61