Skip to content
class method

ENV.[]

ENV[name] → value

Returns the value for the environment variable name if it exists:

Example
ENV['foo'] = '0'
ENV['foo'] # => "0"

Returns nil if the named variable does not exist.

Raises an exception if name is invalid. See Invalid Names and Values.

See also .[]= .assoc also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0