Class: REXML::SyncEnumerator
- Includes:
- Enumerable
- Defined in:
- lib/extensions/rexml/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.
Methods included from Enumerable
#all?, #any?, #collect, #detect, #each_with_index, #find_all, #group_by, #inject, #max, #member?, #min, #sort, #sort_by, #to_a, #to_set
Constructor Details
#initialize(*enums) ⇒ SyncEnumerator
Creates a new SyncEnumerator which enumerates rows of given Enumerable objects.
7 8 9 10 |
# File 'lib/extensions/rexml/rexml/syncenumerator.rb', line 7 def initialize(*enums) @gens = enums @length = @gens.collect {|x| x.size }.max end |
Instance Method Details
#each ⇒ Object
Enumerates rows of the Enumerable objects.
25 26 27 28 29 30 |
# File 'lib/extensions/rexml/rexml/syncenumerator.rb', line 25 def each @length.times {|i| yield @gens.collect {|x| x[i]} } self end |
#length ⇒ Object
Returns the number of enumerated Enumerable objects, i.e. the size of each row.
20 21 22 |
# File 'lib/extensions/rexml/rexml/syncenumerator.rb', line 20 def length @gens.length end |
#size ⇒ Object
Returns the number of enumerated Enumerable objects, i.e. the size of each row.
14 15 16 |
# File 'lib/extensions/rexml/rexml/syncenumerator.rb', line 14 def size @gens.size end |