Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

ENV.size

ENV.length → an_integer
ENV.size → an_integer

Returns the count of environment variables:

Example
ENV.replace('foo' => '0', 'bar' => '1')
ENV.length # => 2
ENV.size # => 2
See also .shift .slice .select! .store also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0