title: What object does ENV return in Ruby?
body: <p>There's an ENV variable we all know. It returns an Object. But the return value of ENV is visually similar to a Hash. But it's really not. </p>
  
  <p>For example:</p>
  
  <pre><code>&gt; ENV
  =&gt; {"SHELL"=&gt;"/bin/bash", "SESSION_MANAGER"=&gt;"local/archlinux:@/tmp/.ICE-unix/613,unix/archlinux:/tmp/.ICE-unix/613", "COLORTERM"=&gt;"truecolor", "XDG_CONFIG_DIRS"=&gt;"/etc/xdg", "XDG_MENU_PREFIX"=&gt;"xfce-", "SSH_AUTH_SOCK"=&gt;"/tmp/ssh-Al0pdO1R5970/agent.622", "DESKTOP_SESSION"=&gt;"Xfce Session", "SSH_AGENT_PID"=&gt;"623", "GTK_MODULES"=&gt;"canberra-gtk-module:canberra-gtk-module", "XDG_SEAT"=&gt;"seat0", "PWD"=&gt;"/home/sourav", "LOGNAME"=&gt;"sourav", "XDG_SESSION_TYPE"=&gt;"x11", "XAUTHORITY"=&gt;"/home/sourav/.Xauthority", "HOME"=&gt;"/home/sourav", "LANG"=&gt;"en_GB.UTF-8", "XDG_CURRENT_DESKTOP"=&gt;"XFCE", "VTE_VERSION"=&gt;"5603", "INVOCATION_ID"=&gt;"6d4dc7a91cc141e691436cb850e18f8d", "GLADE_CATALOG_PATH"=&gt;":", "XDG_SESSION_CLASS"=&gt;"user", "TERM"=&gt;"xterm-256color", "USER"=&gt;"sourav", "DISPLAY"=&gt;":0.0", "SHLVL"=&gt;"2", "XDG_VTNR"=&gt;"1", "XDG_SESSION_ID"=&gt;"1", "TILIX_ID"=&gt;"f2480263-263e-408f-be36-8105e71256a6", "MOZ_PLUGIN_PATH"=&gt;"/usr/lib/mozilla/plugins", "GLADE_MODULE_PATH"=&gt;":", "XDG_RUNTIME_DIR"=&gt;"/run/user/1000", "GLADE_PIXMAP_PATH"=&gt;":", "JOURNAL_STREAM"=&gt;"9:25041", "XDG_DATA_DIRS"=&gt;"/usr/local/share:/usr/share", "PATH"=&gt;"/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/sourav/.rvm/bin:/home/sourav/.rvm/bin:/home/sourav/.gem/ruby/2.6.0/bin", "DBUS_SESSION_BUS_ADDRESS"=&gt;"unix:path=/run/user/1000/bus", "MAIL"=&gt;"/var/spool/mail/sourav", "_"=&gt;"/home/sourav/.irb", "LINES"=&gt;"24", "COLUMNS"=&gt;"80"}
  </code></pre>
  
  <p>Which looks similar to:</p>
  
  <pre><code>&gt; ENV.to_h
  =&gt; {"SHELL"=&gt;"/bin/bash", "SESSION_MANAGER"=&gt;"local/archlinux:@/tmp/.ICE-unix/613,unix/archlinux:/tmp/.ICE-unix/613", "COLORTERM"=&gt;"truecolor", "XDG_CONFIG_DIRS"=&gt;"/etc/xdg", "XDG_MENU_PREFIX"=&gt;"xfce-", "SSH_AUTH_SOCK"=&gt;"/tmp/ssh-Al0pdO1R5970/agent.622", "DESKTOP_SESSION"=&gt;"Xfce Session", "SSH_AGENT_PID"=&gt;"623", "GTK_MODULES"=&gt;"canberra-gtk-module:canberra-gtk-module", "XDG_SEAT"=&gt;"seat0", "PWD"=&gt;"/home/sourav", "LOGNAME"=&gt;"sourav", "XDG_SESSION_TYPE"=&gt;"x11", "XAUTHORITY"=&gt;"/home/sourav/.Xauthority", "HOME"=&gt;"/home/sourav", "LANG"=&gt;"en_GB.UTF-8", "XDG_CURRENT_DESKTOP"=&gt;"XFCE", "VTE_VERSION"=&gt;"5603", "INVOCATION_ID"=&gt;"6d4dc7a91cc141e691436cb850e18f8d", "GLADE_CATALOG_PATH"=&gt;":", "XDG_SESSION_CLASS"=&gt;"user", "TERM"=&gt;"xterm-256color", "USER"=&gt;"sourav", "DISPLAY"=&gt;":0.0", "SHLVL"=&gt;"2", "XDG_VTNR"=&gt;"1", "XDG_SESSION_ID"=&gt;"1", "TILIX_ID"=&gt;"f2480263-263e-408f-be36-8105e71256a6", "MOZ_PLUGIN_PATH"=&gt;"/usr/lib/mozilla/plugins", "GLADE_MODULE_PATH"=&gt;":", "XDG_RUNTIME_DIR"=&gt;"/run/user/1000", "GLADE_PIXMAP_PATH"=&gt;":", "JOURNAL_STREAM"=&gt;"9:25041", "XDG_DATA_DIRS"=&gt;"/usr/local/share:/usr/share", "PATH"=&gt;"/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/sourav/.rvm/bin:/home/sourav/.rvm/bin:/home/sourav/.gem/ruby/2.6.0/bin", "DBUS_SESSION_BUS_ADDRESS"=&gt;"unix:path=/run/user/1000/bus", "MAIL"=&gt;"/var/spool/mail/sourav", "_"=&gt;"/home/sourav/.irb", "LINES"=&gt;"24", "COLUMNS"=&gt;"80"}
  </code></pre>
  
  <p>But:</p>
  
  <pre><code>&gt; ENV.to_h.eql?(ENV)
  =&gt; false
  </code></pre>
  
  <p>So what kind of object does ENV return?</p>