peek_values

e.peek_values â array Instance Public methods Returns the next object as an array, similar to #next_values, but doesn't move the internal position forward. If the position is already at the end, StopIteration is raised. Example o = Object.new def o.each yield yield 1 yield 1, 2 end e = o.to_enum p e.peek_values #=> [] e.next p e.peek_values #=> [1] p e.peek_values #=> [1] e.next p e.peek_values #=> [1, 2] e.next p e.peek_values # raises StopIter

rewind

e.rewind â e Instance Public methods Rewinds the enumeration sequence to the beginning. If the enclosed object responds to a ârewindâ method, it is called.

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

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

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

[]

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.

[]=

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

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.

clear

ENV.clear Class Public methods Removes every environment variable.

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.