In Files

  • rexml/syncenumerator.rb

Parent

Included Modules

Class/Module Index [+]

Quicksearch

REXML::SyncEnumerator

Public Class Methods

new(*enums) click to toggle source

Creates a new SyncEnumerator which enumerates rows of given Enumerable objects.

 
               # File rexml/syncenumerator.rb, line 7
def initialize(*enums)
  @gens = enums
  @biggest = @gens[0]
  @gens.each {|x| @biggest = x if x.size > @biggest.size }
end
            

Public Instance Methods

each() click to toggle source

Enumerates rows of the Enumerable objects.

 
               # File rexml/syncenumerator.rb, line 26
def each
  @biggest.zip( *@gens ) {|a|
    yield(*a[1..-1])
  }
  self
end
            
length() click to toggle source

Returns the number of enumerated Enumerable objects, i.e. the size of each row.

 
               # File rexml/syncenumerator.rb, line 21
def length
  @gens.length
end
            
size() click to toggle source

Returns the number of enumerated Enumerable objects, i.e. the size of each row.

 
               # File rexml/syncenumerator.rb, line 15
def size
  @gens.size
end