Class: ActionView::CollectionRenderer::SameCollectionIterator

Inherits:
CollectionIterator show all
Defined in:
lib/action_view/renderer/collection_renderer.rb

Overview

:nodoc:

Direct Known Subclasses

PreloadCollectionIterator

Instance Method Summary collapse

Methods inherited from CollectionIterator

#each, #length, #size

Constructor Details

#initialize(collection, path, variables) ⇒ SameCollectionIterator

Returns a new instance of SameCollectionIterator.



57
58
59
60
61
# File 'lib/action_view/renderer/collection_renderer.rb', line 57

def initialize(collection, path, variables)
  super(collection)
  @path      = path
  @variables = variables
end

Instance Method Details

#each_with_infoObject



67
68
69
70
71
# File 'lib/action_view/renderer/collection_renderer.rb', line 67

def each_with_info
  return enum_for(:each_with_info) unless block_given?
  variables = [@path] + @variables
  @collection.each { |o| yield(o, variables) }
end

#from_collection(collection) ⇒ Object



63
64
65
# File 'lib/action_view/renderer/collection_renderer.rb', line 63

def from_collection(collection)
  self.class.new(collection, @path, @variables)
end