Class: REXML::SyncEnumerator
- Includes:
- Enumerable
- Defined in:
- lib/rexml/syncenumerator.rb
Instance Method Summary collapse
-
#each ⇒ Object
Enumerates rows of the Enumerable objects.
-
#initialize(*enums) ⇒ SyncEnumerator
constructor
Creates a new SyncEnumerator which enumerates rows of given Enumerable objects.
-
#length ⇒ Object
Returns the number of enumerated Enumerable objects, i.e.
-
#size ⇒ Object
Returns the number of enumerated Enumerable objects, i.e.
Constructor Details
#initialize(*enums) ⇒ SyncEnumerator
Creates a new SyncEnumerator which enumerates rows of given Enumerable objects.
7 8 9 10 11 |
# File 'lib/rexml/syncenumerator.rb', line 7 def initialize(*enums) @gens = enums @biggest = @gens[0] @gens.each {|x| @biggest = x if x.size > @biggest.size } end |
Instance Method Details
#each ⇒ Object
Enumerates rows of the Enumerable objects.
26 27 28 29 30 31 |
# File 'lib/rexml/syncenumerator.rb', line 26 def each @biggest.zip( *@gens ) {|a| yield(*a[1..-1]) } self end |
#length ⇒ Object
Returns the number of enumerated Enumerable objects, i.e. the size of each row.
21 22 23 |
# File 'lib/rexml/syncenumerator.rb', line 21 def length @gens.length end |
#size ⇒ Object
Returns the number of enumerated Enumerable objects, i.e. the size of each row.
15 16 17 |
# File 'lib/rexml/syncenumerator.rb', line 15 def size @gens.size end |