each

ENV.each { |name, value| } â HashENV.each â EnumeratorENV.each_pair { |name, value| } â HashENV.each_pair â Enumerator Class Public methods Yields each environment variable name and value. If no block is given an Enumerator is returned.

delete_if

ENV.delete_if { |name, value| } â HashENV.delete_if â Enumerator Class Public methods Deletes every environment variable for which the block evaluates to true. If no block is given an enumerator is returned instead.

delete

ENV.delete(name) â valueENV.delete(name) { |name| } â value Class Public methods Deletes the environment variable with name and returns the value of the variable. If a block is given it will be called when the named environment does not exist.

clear

ENV.clear Class Public methods Removes every environment variable.

assoc

ENV.assoc(name) â Array or nil Class Public methods Returns an Array of the name and value of the environment variable with name or nil if the name cannot be found.

[]=

ENV[name] = value Class Public methods Sets the environment variable name to value. If the value given is nil the environment variable is deleted.

[]

ENV[name] â value Class Public methods Retrieves the value for environment variable name as a String. Returns nil if the named variable does not exist.

with_object

e.with_object(obj) {|(*args), obj| ... }e.with_object(obj) Instance Public methods Iterates the given block for each element with an arbitrary object, obj, and returns obj If no block is given, returns a new Enumerator. Example to_three = Enumerator.new do |y| 3.times do |x| y << x end end to_three_with_string = to_three.with_object("foo") to_three_with_string.each do |x,string| puts "#{string}: #{x}" end # => foo:0 # => foo:1 # => foo:2

with_index

e.with_index(offset = 0) {|(*args), idx| ... }e.with_index(offset = 0) Instance Public methods Iterates the given block for each element with an index, which starts from offset. If no block is given, returns a new Enumerator that includes the index, starting from offset offset the starting index to use

size

e.size â int, Float::INFINITY or nil Instance Public methods Returns the size of the enumerator, or nil if it can't be calculated lazily. (1..100).to_a.permutation(4).size # => 94109400 loop.size # => Float::INFINITY (1..100).drop_while.size # => nil