Extended maintenance of Ruby versions 1.8.7 and 1.9.2 will end on July 31, 2014. Read more

In Files

  • rexml/syncenumerator.rb

Parent

Included Modules

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
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus