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
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_info ⇒ Object
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 |