Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/extensions/array.rb
Instance Method Summary collapse
Instance Method Details
#each_with_index_and_catch ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/extensions/array.rb', line 4 def each_with_index_and_catch self.each_with_index do |el, index| next if !@skip_iteration_index.nil? && @skip_iteration_index >= index skip_iteration_index = catch :skip_iteration do yield(el, index) if block_given? end @skip_iteration_index = skip_iteration_index if skip_iteration_index.kind_of?(Integer) end end |