Class: ActionView::CollectionRenderer::SameCollectionIterator
- Inherits:
-
CollectionIterator
- Object
- CollectionIterator
- ActionView::CollectionRenderer::SameCollectionIterator
- Defined in:
- lib/action_view/renderer/collection_renderer.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
- #each_with_info ⇒ Object
- #from_collection(collection) ⇒ Object
-
#initialize(collection, path, variables) ⇒ SameCollectionIterator
constructor
A new instance of SameCollectionIterator.
Methods inherited from CollectionIterator
#each, #length, #preload!, #size
Constructor Details
#initialize(collection, path, variables) ⇒ SameCollectionIterator
Returns a new instance of SameCollectionIterator.
61 62 63 64 65 |
# File 'lib/action_view/renderer/collection_renderer.rb', line 61 def initialize(collection, path, variables) super(collection) @path = path @variables = variables end |
Instance Method Details
#each_with_info ⇒ Object
71 72 73 74 75 |
# File 'lib/action_view/renderer/collection_renderer.rb', line 71 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
67 68 69 |
# File 'lib/action_view/renderer/collection_renderer.rb', line 67 def from_collection(collection) self.class.new(collection, @path, @variables) end |