Method: Functional::Tuple#each_with_index
- Defined in:
- lib/functional/tuple.rb
#each_with_index {|item, index| ... } ⇒ Enumerable
Calls the given block once for each element in self, passing that element and the current index as parameters. An Enumerator is returned if no block is given.
160 161 162 163 164 165 |
# File 'lib/functional/tuple.rb', line 160 def each_with_index return enum_for(:each_with_index) unless block_given? @data.each_with_index do |item, index| yield(item, index) end end |