# class Chef::ResourceCollection::StepableIterator

### Attributes

collection[RW]
position[R]

### Public Class Methods

for_collection(new_collection) click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 22
    def self.for_collection(new_collection)
      instance = new(new_collection)
      instance
    end

new(collection=[]) click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 30
    def initialize(collection=[])
      @position = 0
      @paused = false
      @collection = collection
    end

### Public Instance Methods

each(&block) click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 40
    def each(&block)
      reset_iteration(block)
      @iterator_type = :element
      iterate
    end

each_index(&block) click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 46
    def each_index(&block)
      reset_iteration(block)
      @iterator_type = :index
      iterate
    end

each_with_index(&block) click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 52
    def each_with_index(&block)
      reset_iteration(block)
      @iterator_type = :element_with_index
      iterate
    end

iterate_on(iteration_type, &block) click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 89
    def iterate_on(iteration_type, &block)
      @iterator_type = iteration_type
      @iterator_block = block
    end

pause() click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 62
    def pause
      @paused = true
    end

paused?() click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 58
    def paused?
      @paused
    end

resume() click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 66
    def resume
      @paused = false
      iterate
    end

rewind() click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 71
    def rewind
      @position = 0
    end

size() click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 36
    def size
      collection.size
    end

skip_back(skips=1) click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 75
    def skip_back(skips=1)
      @position -= skips
    end

skip_forward(skips=1) click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 79
    def skip_forward(skips=1)
      @position += skips
    end

step() click to toggle source

    # File lib/chef/resource_collection/stepable_iterator.rb, line 83
    def step
      return nil if @position == size
      call_iterator_block
      @position += 1
    end