Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

ENV.values

ENV.values → array of values

Returns all environment variable values in an Array:

Example
ENV.replace('foo' => '0', 'bar' => '1')
ENV.values # => ['1', '0']

The order of the values is OS-dependent. See About Ordering.

Returns the empty Array if ENV is empty.

See also .value? .values_at .update also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0