Class: ActionView::CollectionRenderer::SameCollectionIterator

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

Overview

:nodoc:

Direct Known Subclasses

PreloadCollectionIterator

Instance Method Summary collapse

Methods inherited from CollectionIterator

#each, #size

Methods included from Enumerable

#as_json, #compact_blank, #exclude?, #excluding, #including, #index_by, #index_with, #many?, #pick, #pluck, #sum, #without

Constructor Details

#initialize(collection, path, variables) ⇒ SameCollectionIterator

Returns a new instance of SameCollectionIterator.


53
54
55
56
57
# File 'actionview/lib/action_view/renderer/collection_renderer.rb', line 53

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

Instance Method Details

#each_with_infoObject


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

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


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

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